opswalrus 1.0.48 → 1.0.49

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: 2ccef020c9a8dbe02e313e2cea8d632bde41b4adf7d4632af26d6b86d5e52606
4
- data.tar.gz: 5f2a6342ca5631a4e4284ebfb9a6546106dff4fbce2aa6bafad42d7e897b98e5
3
+ metadata.gz: 90e3b3e2c7e0255ef069e30d31e2125c5bf6fd9c22a15e4aa2057f5265aa6873
4
+ data.tar.gz: 58346bbbcfe19a98add4a83b8936f75c911155f872cf35ecaf56ce32679c1123
5
5
  SHA512:
6
- metadata.gz: 1100b1342196951cdaac37d5dac00a40400d5556c6d4a4fc0a9293fac65a5862639d176e18e1e9cea1230957a110a50853a561bd48f965b42aebf7734b3d0590
7
- data.tar.gz: 9e467f0d02e86bf19fd4385ab62cb7ce739dca3096a159e648909e1d95fdd53c5519cfb98eac37748f5e4cbcb371d59f0247ea2bd51ecf92453d85852564fa3d
6
+ metadata.gz: bde3099dff40f9f00add304bac22a5cf62521a68ed3c9481d7de9ae28f3d520c4457097c3be60fbb569e6c32de4fdc101e620fd5a2ad832d335b638245dcd93e
7
+ data.tar.gz: a1b4a440fd1d9512efe0cdef6110f3849afab3ad3253140dfa253bb30d7fac606a0de6b814f3611e0c063366a9478a2b4fc3ae5e3c962b02d6c76f2dd815dbb2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.48)
4
+ opswalrus (1.0.49)
5
5
  bcrypt_pbkdf (~> 1.1)
6
6
  binding_of_caller (~> 1.0)
7
7
  citrus (~> 3.0)
@@ -1,15 +1,5 @@
1
1
  # ssh_noprep in: :sequence do
2
2
  ssh_noprep do
3
3
  puts "Bootstrapping #{to_s} (alias=#{self.alias})"
4
- stdout, stderr, exit_status = _bootstrap_host()
5
- if exit_status == 0
6
- puts "Success - #{to_s} (alias=#{self.alias})"
7
- else
8
- stdout_report = stdout.lines.last(3).map {|line| " #{line}" }.join()
9
- stderr_report = stderr.lines.last(3).map {|line| " #{line}" }.join()
10
- report = "Failure - #{to_s} (alias=#{self.alias})"
11
- report << "\n stdout:\n#{stdout_report}" unless stdout_report.empty?
12
- report << "\n stderr:\n#{stderr_report}" unless stderr_report.empty?
13
- puts report
14
- end
4
+ _bootstrap_host(true)
15
5
  end
@@ -82,7 +82,7 @@ module OpsWalrus
82
82
  end
83
83
 
84
84
  # returns [stdout, stderr, exit_status]
85
- def _bootstrap_host
85
+ def _bootstrap_host(print_report = true)
86
86
  # copy over bootstrap shell script
87
87
  # io = StringIO.new(bootstrap_shell_script)
88
88
  io = File.open(__FILE__.to_pathname.dirname.join("bootstrap.sh"))
@@ -91,7 +91,23 @@ module OpsWalrus
91
91
  raise Error, "Unable to upload bootstrap shell script to remote host #{to_s} (alias=#{self.alias})" unless upload_success
92
92
  @_host.execute(:chmod, "755", "tmpopsbootstrap.sh")
93
93
  sshkit_cmd = @_host.execute_cmd(:sh, "tmpopsbootstrap.sh")
94
- [sshkit_cmd.full_stdout, sshkit_cmd.full_stderr, sshkit_cmd.exit_status]
94
+
95
+ stdout, stderr, exit_status = [sshkit_cmd.full_stdout, sshkit_cmd.full_stderr, sshkit_cmd.exit_status]
96
+
97
+ if print_report
98
+ if exit_status == 0
99
+ puts "Bootstrap success - #{to_s} (alias=#{self.alias})"
100
+ else
101
+ stdout_report = stdout.lines.last(3).map {|line| " #{line}" }.join()
102
+ stderr_report = stderr.lines.last(3).map {|line| " #{line}" }.join()
103
+ report = "Bootstrap failure - #{to_s} (alias=#{self.alias})"
104
+ report << "\n stdout:\n#{stdout_report}" unless stdout_report.empty?
105
+ report << "\n stderr:\n#{stderr_report}" unless stderr_report.empty?
106
+ puts report
107
+ end
108
+ end
109
+
110
+ [stdout, stderr, exit_status]
95
111
  ensure
96
112
  @_host.execute(:rm, "-f", "tmpopsbootstrap.sh") rescue nil
97
113
  end
@@ -120,8 +120,12 @@ module OpsWalrus
120
120
  host.set_ops_file_script(ops_file_script)
121
121
  host.set_ssh_session_connection(self) # self is an instance of one of the subclasses of SSHKit::Backend::Abstract, e.g. SSHKit::Backend::Netssh
122
122
 
123
- host._bootstrap_host
124
- retval = host._zip_copy_and_run_ops_bundle(local_host, block)
123
+ stdout, stderr, exit_status = host._bootstrap_host(false)
124
+ retval = if exit_status == 0
125
+ host._zip_copy_and_run_ops_bundle(local_host, block)
126
+ else
127
+ puts "Failed to bootstrap #{host}. Unable to run operation."
128
+ end
125
129
 
126
130
  retval
127
131
  rescue SSHKit::Command::Failed => e
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.48"
2
+ VERSION = "1.0.49"
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.48
4
+ version: 1.0.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis