opswalrus 1.0.87 → 1.0.89

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: e024a2720e67646c573e1f6aeb395ab77aab434fb21d9f89dfcb294fe6e9c2cf
4
- data.tar.gz: e4582d19d926b4d2c1f4f70464894261a76c778224323e533759ad473803f18c
3
+ metadata.gz: ea3eb2c025307f4caf46517d31cc699e129f11a1f5af9ab031a17813f54478cb
4
+ data.tar.gz: 22d758a1ac797784030ef99dea7f16cb042060d90a20d826b3d999a0276030fa
5
5
  SHA512:
6
- metadata.gz: 4a17dae780d16aee9604bf2e82a37443a6a880eea65d70fd498df81669017b3e891228ef589749ef68d740ecd78e41db0e9065e196e172074cc8883f60f7da4e
7
- data.tar.gz: 320ba2dc98f63ce60bb75518e368e7cbe4c1cff66dd783493524bea7750d50ac8f9dc7f1868d899af2b51c1b1908091c8e4de843624af7207c79e54276be15ec
6
+ metadata.gz: 335f860e454819af1e4741a06d936a8b2e8b1ab66faf3504b1b064801b3ecd267a1f8034d56ed2a5188b2a560174fcf266c30c510ed5dee20000fa4b230ee337
7
+ data.tar.gz: 82d39a23be2b270400b7f5207570d73d7b8952c1305e214ce38dd5dec3f2084817a96cced59d0d017cdd0334f8748b9c06a0dd359098725238779f4038cafd5a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.87)
4
+ opswalrus (1.0.89)
5
5
  activesupport (~> 7.0)
6
6
  bcrypt_pbkdf (~> 1.1)
7
7
  binding_of_caller (~> 1.0)
data/lib/opswalrus/app.rb CHANGED
@@ -316,10 +316,19 @@ module OpsWalrus
316
316
  SemanticLogger.flush
317
317
  output = StringIO.open do |io|
318
318
  io.puts SCRIPT_RESULT_HEADER
319
- io.puts JSON.pretty_generate(result.value)
319
+ obj = case result
320
+ when Invocation::Success
321
+ result.value
322
+ when Invocation::Error
323
+ {
324
+ error_type: result.value.class,
325
+ error: result.value,
326
+ }
327
+ end
328
+ io.puts JSON.pretty_generate(obj)
320
329
  io.string
321
330
  end
322
- puts "print_script_result - #{Time.now}"
331
+ # puts "print_script_result - #{Time.now.strftime('%s%L')}"
323
332
  puts output
324
333
  end
325
334
  end
@@ -578,6 +578,7 @@ module OpsWalrus
578
578
  end
579
579
  end
580
580
 
581
+ # Returns a SSHKit::Command
581
582
  def execute_cmd(*args, input_mapping: nil, ops_prompt_for_sudo_password: false)
582
583
  # we only want one of the sudo password interaction handlers:
583
584
  # if we're running an ops script on the remote host and we've passed the --pass flag in our invocation of the ops command on the remote host,
@@ -87,14 +87,15 @@ module OpsWalrus
87
87
  end
88
88
  rescue SSHKit::Command::Failed => e
89
89
  App.instance.error "[!] Command failed: #{e.message}"
90
+ Invocation::Error.new(e)
90
91
  rescue Error => e
91
- puts "OperationRunner#run - #{Time.now}"
92
+ # puts "OperationRunner#run - #{Time.now.strftime('%s%L')}"
92
93
  App.instance.error "Error: Ops script crashed."
93
94
  App.instance.error e.message
94
95
  App.instance.error e.backtrace.take(10).join("\n")
95
96
  Invocation::Error.new(e)
96
97
  rescue => e
97
- puts "OperationRunner#run - #{Time.now}"
98
+ # puts "OperationRunner#run - #{Time.now.strftime('%s%L')}"
98
99
  App.instance.error "Unhandled Error: Ops script crashed."
99
100
  App.instance.error e.class
100
101
  App.instance.error e.message
@@ -14,11 +14,13 @@ module SSHKit
14
14
 
15
15
  module Backend
16
16
  class Abstract
17
+ # Returns a SSHKit::Command
17
18
  # def execute(*args)
18
19
  # options = { verbosity: :debug, raise_on_non_zero_exit: false }.merge(args.extract_options!)
19
20
  # create_command_and_execute(args, options).success?
20
21
  # end
21
22
 
23
+ # Returns a SSHKit::Command
22
24
  def execute_cmd(*args)
23
25
  options = { verbosity: :info, strip: true, raise_on_non_zero_exit: false }.merge(args.extract_options!)
24
26
  create_command_and_execute(args, options)
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.87"
2
+ VERSION = "1.0.89"
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.87
4
+ version: 1.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis