opswalrus 1.0.95 → 1.0.96

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: 95840cd4d5d5c4e6931039eb2fa780183c17a6c88fde247f8d425855d0a2ff0e
4
- data.tar.gz: 97ba07f54f39a995982edd6f0ac6497d22b6c3063763379d06a4a9294620b583
3
+ metadata.gz: 8fb52bd8ac55bffca7f34fc6213c004bc8ccc2e01d0e0682682ce077fe273bcb
4
+ data.tar.gz: 4613f02bf1f7479eff1ab78ed2c407507f20bb546a8bd005dd469430e38b15ba
5
5
  SHA512:
6
- metadata.gz: cc97ad6aa85c13f9fc990d57754e6930464c7a7a4379bb7342ae73ac9cbd75ceb5fb8e9311b28dbdfd896b90b7e0fb068398ce9868e22b35f689611a1f24079d
7
- data.tar.gz: 74f423605ce4dbe496c839fa93fed03cf6ae7c49bbbe12fa655b7bfe187af1221d007263819f9cce0cb1f222ee15c37787aff2492a3737bab281b9dff87ac23f
6
+ metadata.gz: 901644932c68e186a15f94b77e179cf8412f9a791e7981fa79b0a4a035696c80e298aabf2a6ceb362dccec370ee2f63a6e174ffe31bb67c49966b7d296a32baf
7
+ data.tar.gz: 3291a2be3c530e81bd6a0ad6706c4281de16df914d0d67aa8adc57b842e74c94305ae60c17c5556b06fe70ecc02ea19467cea323542fac9336ac43a813763abc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.95)
4
+ opswalrus (1.0.96)
5
5
  activesupport (~> 7.0)
6
6
  bcrypt_pbkdf (~> 1.1)
7
7
  binding_of_caller (~> 1.0)
@@ -3,6 +3,10 @@ module OpsWalrus
3
3
  end
4
4
 
5
5
  class RemoteInvocationError < Error
6
+ def initialize(msg, deserialized_invocation_error_hash)
7
+ super(msg)
8
+ @hash = deserialized_invocation_error_hash
9
+ end
6
10
  end
7
11
 
8
12
  class SymbolResolutionError < Error
@@ -216,7 +216,16 @@ module OpsWalrus
216
216
  case retval
217
217
  when Hash
218
218
  if retval["type"] == 'Invocation::Error'
219
- raise RemoteInvocationError.new("Remote Invocation Error:\n #{retval["error_type"]}: #{retval["error"]}#{retval["backtrace"] && "\n Backtrace: #{retval['backtrace']}"}")
219
+ # this structure comes from OpsWalrus::Invocation::Error being serialized in App#print_script_result being called from App#run
220
+ # {
221
+ # type: "Invocation::Error",
222
+ # error_variant: self.class.name,
223
+ # error_class: value.class.name,
224
+ # error: value,
225
+ # backtrace: value.is_a?(Exception) ? value.backtrace.take(10).join("\n") : nil,
226
+ # }
227
+ # raise RemoteInvocationError.new("Remote Invocation Error:\n #{retval["error_class"]}: #{retval["error"]}#{retval["backtrace"] && "\n Backtrace: #{retval['backtrace']}"}")
228
+ raise RemoteInvocationError.new("Remote Invocation Error:\n #{retval["error_class"]}: #{retval["error"]}#{retval["backtrace"] && "\n Backtrace: #{retval['backtrace']}"}", retval)
220
229
  else
221
230
  retval.with_indifferent_access.easynav
222
231
  end
@@ -87,20 +87,20 @@ module OpsWalrus
87
87
  end
88
88
  rescue SSHKit::Command::Failed => e
89
89
  App.instance.error "Runtime error, command failed: #{e.message}"
90
- Invocation::Error.new(e)
90
+ Invocation::SshError.new(e)
91
91
  rescue Error => e
92
92
  # puts "OperationRunner#run - #{Time.now.strftime('%s%L')}"
93
93
  App.instance.error "Runtime error: Ops script crashed."
94
94
  App.instance.error e.message
95
95
  App.instance.error e.backtrace.take(10).join("\n")
96
- Invocation::Error.new(e)
96
+ Invocation::RuntimeError.new(e)
97
97
  rescue => e
98
98
  # puts "OperationRunner#run - #{Time.now.strftime('%s%L')}"
99
99
  App.instance.error "Unhandled runtime error: Ops script crashed."
100
100
  App.instance.error e.class
101
101
  App.instance.error e.message
102
102
  App.instance.error e.backtrace.take(10).join("\n")
103
- Invocation::Error.new(e)
103
+ Invocation::UnhandledError.new(e)
104
104
  end
105
105
 
106
106
  result
@@ -43,7 +43,8 @@ module OpsWalrus
43
43
  def serialize_error
44
44
  {
45
45
  type: "Invocation::Error",
46
- error_type: value.class.name,
46
+ error_variant: self.class.name,
47
+ error_class: value.class.name,
47
48
  error: value,
48
49
  backtrace: value.is_a?(Exception) ? value.backtrace.take(10).join("\n") : nil,
49
50
  }
@@ -52,6 +53,14 @@ module OpsWalrus
52
53
  true
53
54
  end
54
55
  end
56
+ class EarlyExitError < Error
57
+ end
58
+ class SshError < Error
59
+ end
60
+ class RuntimeError < Error
61
+ end
62
+ class UnhandledError < Error
63
+ end
55
64
  end
56
65
 
57
66
 
@@ -178,6 +187,8 @@ module OpsWalrus
178
187
  App.instance.error "[!] The host '#{host}' doesn't accept password authentication method."
179
188
  rescue Errno::EHOSTUNREACH => e
180
189
  App.instance.error "[!] The host '#{host}' is unreachable"
190
+ rescue RemoteInvocationError => e
191
+ results[host] = e
181
192
  # rescue => e
182
193
  # App.instance.error "[!] Command failed:"
183
194
  # App.instance.error e.class
@@ -211,7 +222,7 @@ module OpsWalrus
211
222
  result = if exit_status == 0
212
223
  Invocation::Success.new(nil)
213
224
  else
214
- Invocation::Error.new(nil, exit_status)
225
+ Invocation::EarlyExitError.new(message, exit_status)
215
226
  end
216
227
  throw :exit_now, result
217
228
  end
@@ -1,6 +1,7 @@
1
1
  require 'active_support'
2
2
  require 'active_support/core_ext/hash'
3
3
  require 'active_support/core_ext/hash/indifferent_access'
4
+ require 'active_support/core_ext/string'
4
5
  require 'json'
5
6
  require 'pathname'
6
7
 
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.95"
2
+ VERSION = "1.0.96"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opswalrus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.95
4
+ version: 1.0.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport