opswalrus 1.0.112 → 1.0.113

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bad13d54536897962f10813e8c257db0ea1b1f87fe09ed57d6e6e308712a411
4
- data.tar.gz: bdff12f19797379dbf12d3f50f139ed75d707e979cb801126f1911c8ce9d9e06
3
+ metadata.gz: edb7b34aeba140582fc1c10c2944ff6495a3fd1172d0dfc90fb1db20c0142782
4
+ data.tar.gz: b5243fffab6e5c826ccbda730e4cc8d5c927d4ee8c43b1deae8ff3b21547d215
5
5
  SHA512:
6
- metadata.gz: cbb7989f06344a0976992538ad572dd560ef1894a24f75e151aceb8bce06d2ef44d990e5e4a21e2d0a3321b6b58ab0e2fc74456d113ff678c0659ba016a60450
7
- data.tar.gz: 48f18d1add24a1f9b9a756398b567e6620bb776e86d981acd4cd82f2d1b41e70491bbf22d0388ab605d4174adef675868d4b2ab4c4f0f2dd97986fd842f92867
6
+ metadata.gz: 7d4ed0069f951c872bedbd2a69e631389ca8cf3d9710023aab46f47c03dfce3f77c5da53f022316088990ebf1c05c882a963b097c63986a884f064f12770f716
7
+ data.tar.gz: 5b50dcd941da41c3584cb57d445b1cae5598ea3be6e7ceaee4a0db9984d7f7b3eef26f5605c9d2e4c1ddaa4aecf76ea633a4ffc65447318e940606b8096b7829
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.112)
4
+ opswalrus (1.0.113)
5
5
  activesupport (~> 7.0)
6
6
  bcrypt_pbkdf (~> 1.1)
7
7
  binding_of_caller (~> 1.0)
data/lib/opswalrus/app.rb CHANGED
@@ -59,7 +59,7 @@ module OpsWalrus
59
59
  @pwd = pwd.to_pathname
60
60
  @bundler = Bundler.new(self, @pwd)
61
61
  @local_hostname = "localhost"
62
- @script_mode = false
62
+ @mode = nil
63
63
  @dry_run = false
64
64
  @zip_mutex = Thread::Mutex.new
65
65
  end
@@ -73,11 +73,19 @@ module OpsWalrus
73
73
  end
74
74
 
75
75
  def script_mode!
76
- @script_mode = true
76
+ @mode = :script
77
+ end
78
+
79
+ def pretty_print_mode!
80
+ @mode = :pretty
77
81
  end
78
82
 
79
83
  def script_mode?
80
- @script_mode
84
+ @mode == :script
85
+ end
86
+
87
+ def pretty_print_mode?
88
+ @mode == :pretty
81
89
  end
82
90
 
83
91
  def dry_run?
@@ -321,10 +329,10 @@ module OpsWalrus
321
329
  end
322
330
 
323
331
  def print_script_result(result)
324
- if script_mode?
332
+ if script_mode? || pretty_print_mode?
325
333
  SemanticLogger.flush
326
334
  output = StringIO.open do |io|
327
- io.puts SCRIPT_RESULT_HEADER
335
+ io.puts(SCRIPT_RESULT_HEADER) if script_mode?
328
336
  obj = case result
329
337
  when Invocation::Success
330
338
  result.value
data/lib/opswalrus/cli.rb CHANGED
@@ -225,6 +225,7 @@ module OpsWalrus
225
225
  c.switch [:b, :bundle], desc: "Update bundle prior to running the specified operation"
226
226
  c.switch :pass, desc: "Prompt for a sudo password"
227
227
  c.switch :script, desc: "Script mode"
228
+ c.switch :pretty, desc: "Pretty print mode"
228
229
  c.switch [:r, :remote], desc: "Run the operation on the remote hosts"
229
230
 
230
231
  c.flag [:u, :user], desc: "Specify the user that the operation will run as"
@@ -262,6 +263,8 @@ module OpsWalrus
262
263
 
263
264
  if options[:script]
264
265
  $app.script_mode!
266
+ elsif options[:pretty]
267
+ $app.pretty_print_mode!
265
268
  end
266
269
 
267
270
  exit_status = if options[:remote]
@@ -35,6 +35,11 @@ class EasyNavProxy
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ # Serialize Foo object with its class name and arguments
40
+ def to_json(*args)
41
+ @obj.to_json(*args)
42
+ end
38
43
  end
39
44
 
40
45
  class Hash
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.112"
2
+ VERSION = "1.0.113"
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.112
4
+ version: 1.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-28 00:00:00.000000000 Z
11
+ date: 2024-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport