hotdog 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9389d9529203f20a278c0446d57c1ae72e57cb99
4
- data.tar.gz: 807eab226a18b286a38a7968bfb98ed27525b657
3
+ metadata.gz: 4fbfa980ec0c4cb06df790c420adc03aafc5a71e
4
+ data.tar.gz: c348fd469bd7acc63c0e85ecd7e53db1c30d16d7
5
5
  SHA512:
6
- metadata.gz: ef097ee620a3e70d38195b5f4f6ea32f4d7f439962f68495e7d6997e2e667f963d3ef6bff1395ab524cf5ac0f3a60b812a783a542f5bd74082e207971b96a821
7
- data.tar.gz: e97de69542e3559ea62b19d1a35fb3d3c2ec30102719596050e15b66ab6e7cff06f05a202670a3a9ce054eac576938f8ebbc698fde046009c4d4036327e652d0
6
+ metadata.gz: ef1af21553c95bc8cc2c9043441416fd4d167b2da04d0fadd724bd446f4633d248632cfd096d3349129815b9e654761dd08f2052a7d450bae8f1105f4c07566d
7
+ data.tar.gz: 457b99d664a0f96be234f52787b2d8343f3fad0bbb550196990a916433179718d57fb109915b2d076dc6c1367d956af29bfd7976171696cc98b513e6385dca51
@@ -10,26 +10,40 @@ module Hotdog
10
10
  module Commands
11
11
  class Pssh < SshAlike
12
12
  def define_options(optparse, options={})
13
- default_option(options, :show_identifier, true)
14
13
  super
14
+ default_option(options, :show_identifier, true)
15
15
  optparse.on("--[no-]identifier", "Each output line will be prepended with identifier.") do |identifier|
16
16
  options[:show_identifier] = identifier
17
17
  end
18
+ optparse.on("--stop-on-error", "Stop execution when a remote command fails (valid only if -P is set)") do |v|
19
+ options[:stop_on_error] = v
20
+ end
18
21
  end
19
22
 
20
23
  private
21
24
  def run_main(hosts, options={})
22
- stats = Parallel.map(hosts.each_with_index.to_a, in_threads: parallelism(hosts)) { |host, i|
23
- cmdline = build_command_string(host, @remote_command, options)
24
- identifier = options[:show_identifier] ? host : nil
25
- exec_command(identifier, cmdline, index: i, output: true)
26
- }
27
- if stats.all?
28
- exit(0)
29
- else
25
+ begin
26
+ stats = Parallel.map(hosts.each_with_index.to_a, in_threads: parallelism(hosts)) { |host, i|
27
+ cmdline = build_command_string(host, @remote_command, options)
28
+ identifier = options[:show_identifier] ? host : nil
29
+ success = exec_command(identifier, cmdline, index: i, output: true)
30
+ if !success && options[:stop_on_error]
31
+ raise StopException.new
32
+ end
33
+ }
34
+ if stats.all?
35
+ exit(0)
36
+ else
37
+ exit(1)
38
+ end
39
+ rescue StopException
40
+ logger.info("stopped.")
30
41
  exit(1)
31
42
  end
32
43
  end
44
+
45
+ class StopException < StandardError
46
+ end
33
47
  end
34
48
  end
35
49
  end
@@ -196,8 +196,8 @@ module Hotdog
196
196
  }
197
197
  rule(:identifier_glob) {
198
198
  ( binary_op.absent? >> unary_op.absent? >> identifier.repeat(0) >> (glob >> identifier.maybe).repeat(1) \
199
- | binary_op >> identifier.repeat(1) >> (glob >> identifier.maybe).repeat(1) \
200
- | unary_op >> identifier.repeat(1) >> (glob >> identifier.maybe).repeat(1) \
199
+ | binary_op >> (glob >> identifier.maybe).repeat(1) \
200
+ | unary_op >> (glob >> identifier.maybe).repeat(1) \
201
201
  )
202
202
  }
203
203
  rule(:identifier) {
@@ -217,8 +217,8 @@ module Hotdog
217
217
  }
218
218
  rule(:attribute_glob) {
219
219
  ( binary_op.absent? >> unary_op.absent? >> attribute.repeat(0) >> (glob >> attribute.maybe).repeat(1) \
220
- | binary_op >> attribute.repeat(1) >> (glob >> attribute.maybe).repeat(1) \
221
- | unary_op >> attribute.repeat(1) >> (glob >> attribute.maybe).repeat(1) \
220
+ | binary_op >> (glob >> attribute.maybe).repeat(1) \
221
+ | unary_op >> (glob >> attribute.maybe).repeat(1) \
222
222
  )
223
223
  }
224
224
  rule(:attribute) {
@@ -1,3 +1,3 @@
1
1
  module Hotdog
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler