mofa 0.5.5 → 0.5.6
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 +4 -4
- data/lib/mofa/cli.rb +2 -1
- data/lib/mofa/mofa_cmd.rb +1 -1
- data/lib/mofa/provision_cmd.rb +8 -8
- data/lib/mofa/released_cookbook.rb +1 -1
- data/lib/mofa/upload_cmd.rb +1 -1
- data/lib/mofa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5efe371265582362dd1c4fe8dd07eda8edb0f30d
|
4
|
+
data.tar.gz: 54b293d5773089c5af94a3fb583f834dabf76882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c23a3c1066f0e4265ed3150bf57b556c8876dfe3d53aab4391c5bcd6c37a51437ec48530c6e3ba808725d61ba179a290c1b851d3888c65c3527777ce6eec8a3f
|
7
|
+
data.tar.gz: 22481687e449b1c8d25c4f2180c7dd7c91bcda22a147f80fe3626b497dd6198525ed830d86528319f2b8e97773e07a1f8c9e688fcd92d8ca7214e60e0d7a4df2
|
data/lib/mofa/cli.rb
CHANGED
@@ -19,6 +19,7 @@ module Mofa
|
|
19
19
|
method_option :ignore_ping, :type => :boolean, :aliases => '-p'
|
20
20
|
method_option :target, :type => :string, :aliases => '-t'
|
21
21
|
method_option :concrete_target, :type => :string, :aliases => '-T'
|
22
|
+
method_option :sshport, :type => :string, :aliases => '-P'
|
22
23
|
method_option :runlist, :type => :string, :aliases => '-o'
|
23
24
|
method_option :attributes, :type => :string, :aliases => '-j'
|
24
25
|
method_option :service_hostlist_url, :type => :string
|
@@ -47,7 +48,7 @@ module Mofa
|
|
47
48
|
cmd.options = options
|
48
49
|
|
49
50
|
cmd.prepare
|
50
|
-
cmd.execute
|
51
|
+
cmd.execute(options[:sshport])
|
51
52
|
cmd.cleanup
|
52
53
|
end
|
53
54
|
|
data/lib/mofa/mofa_cmd.rb
CHANGED
data/lib/mofa/provision_cmd.rb
CHANGED
@@ -14,7 +14,7 @@ class ProvisionCmd < MofaCmd
|
|
14
14
|
cookbook.prepare
|
15
15
|
end
|
16
16
|
|
17
|
-
def execute
|
17
|
+
def execute(sshport = 22)
|
18
18
|
cookbook.execute
|
19
19
|
|
20
20
|
hostlist.retrieve
|
@@ -30,7 +30,7 @@ class ProvisionCmd < MofaCmd
|
|
30
30
|
|
31
31
|
puts "Hostlist after runlist filtering: #{hostlist.list.inspect}"
|
32
32
|
|
33
|
-
exit_code = run_chef_solo_on_hosts
|
33
|
+
exit_code = run_chef_solo_on_hosts(sshport)
|
34
34
|
|
35
35
|
exit_code
|
36
36
|
end
|
@@ -121,13 +121,13 @@ class ProvisionCmd < MofaCmd
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
def run_chef_solo_on_hosts
|
124
|
+
def run_chef_solo_on_hosts(sshport = Mofa::Config.config['ssh_port'])
|
125
125
|
time = Time.new
|
126
126
|
# Create a temp working dir on the target host
|
127
127
|
solo_dir = '/var/tmp/' + time.strftime('%Y-%m-%d_%H%M%S')
|
128
128
|
puts
|
129
129
|
puts 'Chef-Solo Run started at ' + time.strftime('%Y-%m-%d %H:%M:%S')
|
130
|
-
puts "Will use ssh_user #{Mofa::Config.config['ssh_user']}, ssh_port #{
|
130
|
+
puts "Will use ssh_user #{Mofa::Config.config['ssh_user']}, ssh_port #{sshport} and ssh_key_file #{Mofa::Config.config['ssh_keyfile']}"
|
131
131
|
at_least_one_chef_solo_run_failed = false
|
132
132
|
chef_solo_runs = {}
|
133
133
|
host_index = 0
|
@@ -146,7 +146,7 @@ class ProvisionCmd < MofaCmd
|
|
146
146
|
|
147
147
|
prepare_host(hostname, host_index, solo_dir)
|
148
148
|
|
149
|
-
Net::SFTP.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port:
|
149
|
+
Net::SFTP.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port: sshport, use_agent: false, verbose: :error) do |sftp|
|
150
150
|
# remotely creating solo.rb
|
151
151
|
create_solo_rb(sftp, hostname, solo_dir)
|
152
152
|
|
@@ -164,7 +164,7 @@ class ProvisionCmd < MofaCmd
|
|
164
164
|
# Do it -> Execute the chef-solo run!
|
165
165
|
begin
|
166
166
|
begin
|
167
|
-
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port:
|
167
|
+
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port: sshport, use_agent: false, verbose: :error) do |ssh|
|
168
168
|
puts "Remotely unpacking Cookbook Package #{cookbook.pkg_name}... "
|
169
169
|
ssh.exec!("cd #{solo_dir}; tar xvfz #{cookbook.pkg_name}") do |_ch, _stream, line|
|
170
170
|
puts line if Mofa::CLI.option_debug
|
@@ -181,7 +181,7 @@ class ProvisionCmd < MofaCmd
|
|
181
181
|
raise e
|
182
182
|
end
|
183
183
|
begin
|
184
|
-
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port:
|
184
|
+
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port: sshport, use_agent: false, verbose: :error) do |ssh|
|
185
185
|
puts "Remotely running chef-solo -c #{solo_dir}/solo.rb -j #{solo_dir}/node.json"
|
186
186
|
chef_run_exit_code = 0
|
187
187
|
ssh.exec!("sudo chef-solo -c #{solo_dir}/solo.rb -j #{solo_dir}/node.json") do |_ch, _stream, line|
|
@@ -207,7 +207,7 @@ class ProvisionCmd < MofaCmd
|
|
207
207
|
log_file.write('chef-solo run: FAIL')
|
208
208
|
puts "ERRORS detected while provisioning #{hostname} (#{e.message})."
|
209
209
|
end
|
210
|
-
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port:
|
210
|
+
Net::SSH.start(hostname, Mofa::Config.config['ssh_user'], keys: [Mofa::Config.config['ssh_keyfile']], port: sshport, use_agent: false, verbose: :error) do |ssh|
|
211
211
|
snapshot_or_release = cookbook.is_a?(SourceCookbook) ? 'snapshot' : 'release'
|
212
212
|
out = ssh_exec!(ssh, "sudo chown -R #{Mofa::Config.config['ssh_user']}.#{Mofa::Config.config['ssh_user']} #{solo_dir}")
|
213
213
|
puts "ERROR (#{out[0]}): #{out[2]}" if out[0] != 0
|
data/lib/mofa/upload_cmd.rb
CHANGED
data/lib/mofa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Birk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|