opswalrus 1.0.61 → 1.0.62

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: 0f769d32a2757cb6bc9e23d27e4baa456b6df7b4b5509babc4b9aecc47309d60
4
- data.tar.gz: 2141371e0a1085ac11ff99d9e4f9ba834d30819b5c2985fc6cb0df8773537ae6
3
+ metadata.gz: 23ccee9336c9eeffa5c8bf4fd9c4f26353eb49fada6d7643ad236b81f5ad4061
4
+ data.tar.gz: b43f9ee85f5557c60506d74a9a21d7d31d21762a47449bed8fa6a145cc05f8eb
5
5
  SHA512:
6
- metadata.gz: 3294b14a48c18633e61e201ff181e9c4bbf827d6ab54d59e9ca464d23b200dfb84fa42b33e3fd67ccae41497e48f9a5cdca7b48cf06c4d52b0f723edf9dac925
7
- data.tar.gz: 232e0c5fb989cbc38d7e0a2c22c1efb69c6de58025326a58f59a140e5cc8400bbad77e069262c296508349992b341319d684c0d0b6b8585991896383f596b33c
6
+ metadata.gz: 2f172ded5af3368a410705b17ea624da8ab0f994d84a2441a403066af0a4b56010345bee5437b9eac8d2cc883644d4febc479d666a4a5b4309efe6ce841d22f9
7
+ data.tar.gz: 4022b1f2bf0aadbd83067798639f6ac593228f9d54cc3f79e0df3dee5172069a59ce72421f569a140ee31b1f382724435482c7860bcf8eb02d783150ab37e78e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.61)
4
+ opswalrus (1.0.62)
5
5
  activesupport (~> 7.0)
6
6
  bcrypt_pbkdf (~> 1.1)
7
7
  binding_of_caller (~> 1.0)
@@ -273,7 +273,7 @@ module OpsWalrus
273
273
  return unless cmd && !cmd.strip.empty?
274
274
 
275
275
  t1 = Time.now
276
- out, err, exit_status = if App.instance.dry_run?
276
+ output, stderr, exit_status = if App.instance.dry_run?
277
277
  ["", "", 0]
278
278
  else
279
279
  sshkit_cmd = execute_cmd(cmd, input_mapping: input, ops_prompt_for_sudo_password: ops_prompt_for_sudo_password)
@@ -282,17 +282,19 @@ module OpsWalrus
282
282
  t2 = Time.now
283
283
  seconds = t2 - t1
284
284
 
285
+ stdout, remote_ops_script_retval = parse_stdout_and_script_return_value(output)
286
+
285
287
  output_block = StringIO.open do |io|
286
288
  if App.instance.info? # this is true if log_level is trace, debug, info
287
289
  if App.instance.trace?
288
- io.puts Style.cyan(out)
289
- io.puts Style.red(err)
290
+ io.puts Style.cyan(stdout)
291
+ io.puts Style.red(stderr)
290
292
  elsif App.instance.debug?
291
- io.puts Style.cyan(out)
292
- io.puts Style.red(err)
293
+ io.puts Style.cyan(stdout)
294
+ io.puts Style.red(stderr)
293
295
  elsif App.instance.info?
294
- io.puts Style.cyan(out)
295
- io.puts Style.red(err)
296
+ io.puts Style.cyan(stdout)
297
+ io.puts Style.red(stderr)
296
298
  end
297
299
  io.print Style.yellow(cmd_id)
298
300
  io.print Style.blue(" | Finished in #{seconds} seconds with exit status ")
@@ -315,7 +317,23 @@ module OpsWalrus
315
317
  end
316
318
  puts output_block unless output_block.empty?
317
319
 
318
- [out, err, exit_status]
320
+ out = remote_ops_script_retval || stdout
321
+ [out, stderr, exit_status]
322
+ end
323
+
324
+ def parse_stdout_and_script_return_value(command_output)
325
+ output_sections = command_output.split(/^#{::OpsWalrus::App::SCRIPT_RESULT_HEADER}$/)
326
+ case output_sections.count
327
+ when 1
328
+ stdout, ops_script_retval = output_sections.first, nil
329
+ when 2
330
+ stdout, ops_script_retval = *output_sections
331
+ else
332
+ # this is unexpected
333
+ ops_script_retval = output_sections.pop
334
+ stdout = output_sections.join(::OpsWalrus::App::SCRIPT_RESULT_HEADER)
335
+ end
336
+ [stdout, ops_script_retval]
319
337
  end
320
338
 
321
339
  # runs the specified ops command with the specified command arguments
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.61"
2
+ VERSION = "1.0.62"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opswalrus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.61
4
+ version: 1.0.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis