hybrid_platforms_conductor 33.0.3 → 33.0.4
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/CHANGELOG.md +12 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -11
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +28 -32
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bedd336d4e713f15ac516cd61d50cf964c2a25051fbb624e1ca75196ccd9dd39
|
|
4
|
+
data.tar.gz: 2d75b29868194072733dd273f6d2f17ca001cc167f446105b72381e1620c57a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4333f83879592e3089ce6cf0e40609efab2435fe9bbecae699462871bab7c3df6b5e44da476b823dfde6f0f1868d1cbd5ca621a076ca147355950b1610b6e38
|
|
7
|
+
data.tar.gz: e0f21e5ccec863d19c93fa1f36bcf51ce1be1a7b1e7bcdbcf83329914df3b3c852eb43b8af2e178b68f94305584c406007de0d47acc713f8170e7b7bba3da621
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [v33.0.4](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.3...v33.0.4) (2021-06-18 10:09:57)
|
|
2
|
+
|
|
3
|
+
## Global changes
|
|
4
|
+
### Patches
|
|
5
|
+
|
|
6
|
+
* [[Fix(cmd_runner)] [#69] Make sure commands are run in unbundled env](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/0795c1ffdcf1b355c9dc91423bb6b7d88918fcf7)
|
|
7
|
+
|
|
8
|
+
## Changes for cmd_runner
|
|
9
|
+
### Patches
|
|
10
|
+
|
|
11
|
+
* [[Fix(cmd_runner)] [#69] Make sure commands are run in unbundled env](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/0795c1ffdcf1b355c9dc91423bb6b7d88918fcf7)
|
|
12
|
+
|
|
1
13
|
# [v33.0.3](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.2...v33.0.3) (2021-06-17 12:42:32)
|
|
2
14
|
|
|
3
15
|
### Patches
|
|
@@ -130,18 +130,20 @@ module HybridPlatformsConductor
|
|
|
130
130
|
(log_to_stdout ? [@logger_stderr] : []) +
|
|
131
131
|
(file_output.nil? ? [] : [file_output])
|
|
132
132
|
) do
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
Bundler.with_unbundled_env do
|
|
134
|
+
cmd_result = TTY::Command.new(
|
|
135
|
+
printer: :null,
|
|
136
|
+
pty: true,
|
|
137
|
+
timeout: timeout,
|
|
138
|
+
uuid: false
|
|
139
|
+
).run!(cmd) do |stdout, stderr|
|
|
140
|
+
stdout_queue << stdout if stdout
|
|
141
|
+
stderr_queue << stderr if stderr
|
|
142
|
+
end
|
|
143
|
+
exit_status = cmd_result.exit_status
|
|
144
|
+
cmd_stdout = cmd_result.out
|
|
145
|
+
cmd_stderr = cmd_result.err
|
|
141
146
|
end
|
|
142
|
-
exit_status = cmd_result.exit_status
|
|
143
|
-
cmd_stdout = cmd_result.out
|
|
144
|
-
cmd_stderr = cmd_result.err
|
|
145
147
|
end
|
|
146
148
|
rescue TTY::Command::TimeoutExceeded
|
|
147
149
|
exit_status = :timeout
|
|
@@ -50,7 +50,9 @@ module HybridPlatformsConductor
|
|
|
50
50
|
# [API] - @stdout_io can be used to send stdout output
|
|
51
51
|
# [API] - @stderr_io can be used to send stderr output
|
|
52
52
|
def remote_interactive
|
|
53
|
-
|
|
53
|
+
Bundler.with_unbundled_env do
|
|
54
|
+
system "cd #{workspace_for(@node)} ; /bin/bash"
|
|
55
|
+
end
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
# rubocop:disable Lint/UnusedMethodArgument
|
|
@@ -74,18 +74,16 @@ module HybridPlatformsConductor
|
|
|
74
74
|
# [API] - @cmd_runner is accessible.
|
|
75
75
|
def setup
|
|
76
76
|
required_version = YAML.load_file("#{@repository_path}/chef_versions.yml")['workstation']
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@cmd_runner.run_cmd "curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}" unless existing_version == required_version
|
|
88
|
-
end
|
|
77
|
+
exit_status, stdout, _stderr = @cmd_runner.run_cmd '/opt/chef-workstation/bin/chef --version', expected_code: [0, :command_error]
|
|
78
|
+
existing_version =
|
|
79
|
+
if exit_status == :command_error
|
|
80
|
+
'not installed'
|
|
81
|
+
else
|
|
82
|
+
expected_match = stdout.match(/^Chef Workstation version: (.+)\.\d+$/)
|
|
83
|
+
expected_match.nil? ? 'unreadable' : expected_match[1]
|
|
84
|
+
end
|
|
85
|
+
log_debug "Current Chef version: #{existing_version}. Required version: #{required_version}"
|
|
86
|
+
@cmd_runner.run_cmd "curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}" unless existing_version == required_version
|
|
89
87
|
end
|
|
90
88
|
|
|
91
89
|
# Get the list of known nodes.
|
|
@@ -160,27 +158,25 @@ module HybridPlatformsConductor
|
|
|
160
158
|
current_package_info = File.exist?(package_info_file) ? JSON.parse(File.read(package_info_file)).transform_keys(&:to_sym) : {}
|
|
161
159
|
next if current_package_info == package_info
|
|
162
160
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
policy_file = local_policy_file
|
|
175
|
-
end
|
|
176
|
-
lock_file = "#{File.dirname(policy_file)}/#{File.basename(policy_file, '.rb')}.lock.json"
|
|
177
|
-
# If the policy lock file does not exist, generate it
|
|
178
|
-
@cmd_runner.run_cmd "cd #{@repository_path} && /opt/chef-workstation/bin/chef install #{policy_file} --chef-license accept" unless File.exist?("#{@repository_path}/#{lock_file}")
|
|
179
|
-
extra_cp_data_bags = File.exist?("#{@repository_path}/data_bags") ? " && cp -ar data_bags/ #{package_dir}/" : ''
|
|
180
|
-
@cmd_runner.run_cmd "cd #{@repository_path} && \
|
|
181
|
-
#{@cmd_runner.root? ? '' : 'sudo '}rm -rf #{package_dir} && \
|
|
182
|
-
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir} --chef-license accept#{extra_cp_data_bags}"
|
|
161
|
+
policy_file = "policyfiles/#{service}.rb"
|
|
162
|
+
if local_environment
|
|
163
|
+
local_policy_file = "policyfiles/#{service}.local.rb"
|
|
164
|
+
# In local mode, we always regenerate the lock file as we may modify the run list
|
|
165
|
+
run_list = known_cookbook_paths.any? { |cookbook_path| File.exist?("#{@repository_path}/#{cookbook_path}/hpc_test/recipes/before_run.rb") } ? ['hpc_test::before_run'] : []
|
|
166
|
+
dsl_parser = DslParser.new
|
|
167
|
+
dsl_parser.parse("#{@repository_path}/#{policy_file}")
|
|
168
|
+
run_list.concat dsl_parser.calls.find { |call_info| call_info[:method] == :run_list }[:args].flatten
|
|
169
|
+
run_list << 'hpc_test::after_run' if known_cookbook_paths.any? { |cookbook_path| File.exist?("#{@repository_path}/#{cookbook_path}/hpc_test/recipes/after_run.rb") }
|
|
170
|
+
File.write("#{@repository_path}/#{local_policy_file}", File.read("#{@repository_path}/#{policy_file}") + "\nrun_list #{run_list.map { |recipe| "'#{recipe}'" }.join(', ')}\n")
|
|
171
|
+
policy_file = local_policy_file
|
|
183
172
|
end
|
|
173
|
+
lock_file = "#{File.dirname(policy_file)}/#{File.basename(policy_file, '.rb')}.lock.json"
|
|
174
|
+
# If the policy lock file does not exist, generate it
|
|
175
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && /opt/chef-workstation/bin/chef install #{policy_file} --chef-license accept" unless File.exist?("#{@repository_path}/#{lock_file}")
|
|
176
|
+
extra_cp_data_bags = File.exist?("#{@repository_path}/data_bags") ? " && cp -ar data_bags/ #{package_dir}/" : ''
|
|
177
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && \
|
|
178
|
+
#{@cmd_runner.root? ? '' : 'sudo '}rm -rf #{package_dir} && \
|
|
179
|
+
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir} --chef-license accept#{extra_cp_data_bags}"
|
|
184
180
|
next if @cmd_runner.dry_run
|
|
185
181
|
|
|
186
182
|
# Create secrets file
|
|
@@ -45,6 +45,12 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
it 'runs a command in an un-bundled environment' do
|
|
49
|
+
with_repository do
|
|
50
|
+
expect(test_cmd_runner.run_cmd('echo "${BUNDLE_GEMFILE}"')).to eq [0, "\n", '']
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
48
54
|
it 'fails when the command does not exit 0' do
|
|
49
55
|
with_repository do
|
|
50
56
|
expect { test_cmd_runner.run_cmd 'exit 1' }.to raise_error(HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command \'exit 1\' returned error code 1 (expected 0).')
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hybrid_platforms_conductor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 33.0.
|
|
4
|
+
version: 33.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Muriel Salvan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-06-
|
|
11
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: range_operators
|