hybrid_platforms_conductor 33.0.3 → 33.0.4

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: eada2aa4c440c2fdfc69fc7f6ec20d2175d4d52d7405bc192ae32cf7a4850f38
4
- data.tar.gz: a720caa3b3c584a5c354cb787a5374866bfa40f7740ecf727d14db9a271e09d5
3
+ metadata.gz: bedd336d4e713f15ac516cd61d50cf964c2a25051fbb624e1ca75196ccd9dd39
4
+ data.tar.gz: 2d75b29868194072733dd273f6d2f17ca001cc167f446105b72381e1620c57a1
5
5
  SHA512:
6
- metadata.gz: 5369c44dd7647622a49f8db8c01722ca0ba96ff7c5e7439fb3c4b208faea076513de0ec47fe3f5a6612807680ecff7b7e2962baf3da569c67c3fd8632dfb9a20
7
- data.tar.gz: 882ca15df05a0a209a7de8f723cc5ddda0a3ea89ce3b5655d6b5c4968e01adc9aa07437bbd17dafe6363331f373776c84fca307e150a53c69ef800926e54ee92
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
- cmd_result = TTY::Command.new(
134
- printer: :null,
135
- pty: true,
136
- timeout: timeout,
137
- uuid: false
138
- ).run!(cmd) do |stdout, stderr|
139
- stdout_queue << stdout if stdout
140
- stderr_queue << stderr if stderr
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
- system "cd #{workspace_for(@node)} ; /bin/bash"
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
- Bundler.with_unbundled_env do
78
- exit_status, stdout, _stderr = @cmd_runner.run_cmd '/opt/chef-workstation/bin/chef --version', expected_code: [0, :command_error]
79
- existing_version =
80
- if exit_status == :command_error
81
- 'not installed'
82
- else
83
- expected_match = stdout.match(/^Chef Workstation version: (.+)\.\d+$/)
84
- expected_match.nil? ? 'unreadable' : expected_match[1]
85
- end
86
- log_debug "Current Chef version: #{existing_version}. Required version: #{required_version}"
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
- Bundler.with_unbundled_env do
164
- policy_file = "policyfiles/#{service}.rb"
165
- if local_environment
166
- local_policy_file = "policyfiles/#{service}.local.rb"
167
- # In local mode, we always regenerate the lock file as we may modify the run list
168
- run_list = known_cookbook_paths.any? { |cookbook_path| File.exist?("#{@repository_path}/#{cookbook_path}/hpc_test/recipes/before_run.rb") } ? ['hpc_test::before_run'] : []
169
- dsl_parser = DslParser.new
170
- dsl_parser.parse("#{@repository_path}/#{policy_file}")
171
- run_list.concat dsl_parser.calls.find { |call_info| call_info[:method] == :run_list }[:args].flatten
172
- 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") }
173
- File.write("#{@repository_path}/#{local_policy_file}", File.read("#{@repository_path}/#{policy_file}") + "\nrun_list #{run_list.map { |recipe| "'#{recipe}'" }.join(', ')}\n")
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
@@ -1,5 +1,5 @@
1
1
  module HybridPlatformsConductor
2
2
 
3
- VERSION = '33.0.3'
3
+ VERSION = '33.0.4'
4
4
 
5
5
  end
@@ -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.3
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-17 00:00:00.000000000 Z
11
+ date: 2021-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: range_operators