opswalrus 1.0.88 → 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: 703da1a1b022f991a69ecfa188f4496d74c82e96a27887f551b139d585791998
4
- data.tar.gz: 1fa08b197ea37718895f13aca963ef57103cf82f8c750a2ff0827bc9252db3bd
3
+ metadata.gz: ea3eb2c025307f4caf46517d31cc699e129f11a1f5af9ab031a17813f54478cb
4
+ data.tar.gz: 22d758a1ac797784030ef99dea7f16cb042060d90a20d826b3d999a0276030fa
5
5
  SHA512:
6
- metadata.gz: 637781b6f336c4a7535887e7a81ffbd015f60d91c21a21256129b3b7868b0de9ede0e7d716508ec5c73cad08aa63fc247485e454d2cf05f56ebf9c98992f4a9f
7
- data.tar.gz: 0102ea0a4902ae0841f2e119981a7fec5994208383824b07d36b0bd9089fd4c3ba844aebec46950b239d2bd10acb536d74ea7ce76fa03b56128e923062f91020
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.88)
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.strftime('%s%L')}"
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.strftime('%s%L')}"
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.strftime('%s%L')}"
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.88"
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.88
4
+ version: 1.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis