choria-mcorpc-support 2.25.3 → 2.26.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
  SHA256:
3
- metadata.gz: 6ea0c40e0fddf65e2507b695f3bfe70a21252ebc43747f03e549d2741c4eda04
4
- data.tar.gz: 0305377ba6a38d5a213cc46ac7e5b09dc82829d6e32cab8e77f7f7da75225bb4
3
+ metadata.gz: d38a022de3a9f8e30351c3281d34011f84d792d09f13955b705ff2ff5502140b
4
+ data.tar.gz: a3a5ce9b97f9b479b7530b7af1645a20049a15d4dbc2f6159539c6731c441eee
5
5
  SHA512:
6
- metadata.gz: 974f141cd420b640f96fa3aeac2c6fc4148ddb31dfd226f2f9c02c9f0ba3aa97f2094cac9dd1e87bf40eb169c9d3d4114e570f3485eac0a58f2faa54eb84b060
7
- data.tar.gz: 073e8a67eaa6b53d8650128c550327b6b34b7003f74b7958d959515ab7ce6511f8870d5463d72b1474ffc80ece4ccb449d23b0f34da7ada182ac01ba5cb4d2fc
6
+ metadata.gz: 95d4ad08da80cccbb2f4904764bb4285ada306dc023cc922543cafe89aaf66eabf04ddda44e1b1290b9a212bb66a44430009e8d48c135382a7c830b9d89a3f7a
7
+ data.tar.gz: 99a3586fc1327ae2597a642c9105c3418622fc0c058977ec0b95ea6dbbbd75af215fb1fee66e023c97b61d72d7207c23a87cc41d6680aa5ef2c1520eb8a910e6
@@ -213,7 +213,9 @@ Examples:
213
213
  Util.colorize(:bold, bolt_tasks.ddl.meta[:timeout])
214
214
  ])
215
215
 
216
- request_and_report(:run_and_wait, request)
216
+ success = request_and_report(:run_and_wait, request)
217
+
218
+ exit(success ? 0 : 1)
217
219
  end
218
220
  ensure
219
221
  reset_client!
@@ -273,11 +275,15 @@ Examples:
273
275
  else
274
276
  say("Requesting task status for request %s, showing failures only pass --verbose for all output" % Util.colorize(:bold, taskid)) unless options[:verbose]
275
277
 
276
- request_and_report(:task_status, {:task_id => taskid}, taskid)
278
+ success = request_and_report(:task_status, {:task_id => taskid}, taskid)
279
+
280
+ exit(success ? 0 : 1)
277
281
  end
278
282
  end
279
283
 
280
284
  def request_and_report(action, arguments, taskid=nil) # rubocop:disable Metrics/MethodLength
285
+ res = true
286
+
281
287
  task_not_known_nodes = 0
282
288
  wrapper_failure = 0
283
289
  completed_nodes = 0
@@ -302,16 +308,24 @@ Examples:
302
308
  status = reply[:data]
303
309
 
304
310
  if reply[:statuscode] == 3
311
+ res = false
305
312
  fail_nodes += 1
306
313
  task_not_known_nodes += 1
307
314
  elsif [-1, 0].include?(status[:exitcode])
308
315
  status[:completed] ? completed_nodes += 1 : running_nodes += 1
309
316
  runtime += status[:runtime]
310
- reply[:statuscode] == 0 ? success_nodes += 1 : fail_nodes += 1
317
+ if reply[:statuscode] == 0
318
+ success_nodes += 1
319
+ else
320
+ res = false
321
+ fail_nodes += 1
322
+ end
311
323
  elsif reply[:statuscode] == 5
324
+ res = false
312
325
  wrapper_failure += 1
313
326
  fail_nodes += 1
314
327
  else
328
+ res = false
315
329
  fail_nodes += 1
316
330
  end
317
331
 
@@ -351,6 +365,8 @@ Examples:
351
365
  runtime,
352
366
  bolt_tasks.stats
353
367
  )
368
+
369
+ res
354
370
  ensure
355
371
  reset_client!
356
372
  end
@@ -81,6 +81,13 @@ module MCollective
81
81
  @result["value"]
82
82
  end
83
83
 
84
+ # Access the value returned by a Bolt task
85
+ #
86
+ # @return [Object] The value returned by the bolt task
87
+ def bolt_task_result
88
+ @bolt_task_result ||= JSON.parse(@result["value"]["data"]["stdout"])
89
+ end
90
+
84
91
  def to_s
85
92
  if Object.const_defined?(:Puppet)
86
93
  Puppet::Pops::Types::StringConverter.convert(self, "%p")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choria-mcorpc-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.25.3
4
+ version: 2.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.I.Pienaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubyforge_project:
250
- rubygems_version: 2.7.6.2
250
+ rubygems_version: 2.7.6.3
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Support libraries the Choria Server