opswalrus 1.0.61 → 1.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/opswalrus/host.rb +26 -8
- data/lib/opswalrus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23ccee9336c9eeffa5c8bf4fd9c4f26353eb49fada6d7643ad236b81f5ad4061
|
|
4
|
+
data.tar.gz: b43f9ee85f5557c60506d74a9a21d7d31d21762a47449bed8fa6a145cc05f8eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f172ded5af3368a410705b17ea624da8ab0f994d84a2441a403066af0a4b56010345bee5437b9eac8d2cc883644d4febc479d666a4a5b4309efe6ce841d22f9
|
|
7
|
+
data.tar.gz: 4022b1f2bf0aadbd83067798639f6ac593228f9d54cc3f79e0df3dee5172069a59ce72421f569a140ee31b1f382724435482c7860bcf8eb02d783150ab37e78e
|
data/Gemfile.lock
CHANGED
data/lib/opswalrus/host.rb
CHANGED
|
@@ -273,7 +273,7 @@ module OpsWalrus
|
|
|
273
273
|
return unless cmd && !cmd.strip.empty?
|
|
274
274
|
|
|
275
275
|
t1 = Time.now
|
|
276
|
-
|
|
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(
|
|
289
|
-
io.puts Style.red(
|
|
290
|
+
io.puts Style.cyan(stdout)
|
|
291
|
+
io.puts Style.red(stderr)
|
|
290
292
|
elsif App.instance.debug?
|
|
291
|
-
io.puts Style.cyan(
|
|
292
|
-
io.puts Style.red(
|
|
293
|
+
io.puts Style.cyan(stdout)
|
|
294
|
+
io.puts Style.red(stderr)
|
|
293
295
|
elsif App.instance.info?
|
|
294
|
-
io.puts Style.cyan(
|
|
295
|
-
io.puts Style.red(
|
|
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
|
-
|
|
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
|
data/lib/opswalrus/version.rb
CHANGED