hybrid_platforms_conductor 32.11.2 → 32.12.0

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: 2162d052fbbe0833d8a26d94d9fc8a490e9c57b0fd35ecd5656be8d3a52a2893
4
- data.tar.gz: 40d6251c2dac02c7588ea158174ecb6da4f2381712e8696b5395fdfcb05555ce
3
+ metadata.gz: d35b83051c7c0be0483d1c69eb3262d53ebf081f59b147160914eaef41fe4096
4
+ data.tar.gz: 7af2e0e2be5e1fe1cc1a34286003ca84889f40c6a356e36a0f84646e12570fbb
5
5
  SHA512:
6
- metadata.gz: 572f8136afc8153bcb645c2612b128b7c6aeb2b44fc795fa1785f0dc6bad06298171466b37aef5d03ad38d6f49cb39cab3c268ce6edc0807cb125328e24c6cba
7
- data.tar.gz: 993478c8a81af0e5bfce3a74cfe5ce9c8bb4259d0f6063e41912ea905d493a2e6cca801525d45ffd080ba1570d80e2c0097e56aac33ee694526e53e6ee9685ee
6
+ metadata.gz: 2e7335248a5715edaa4f5a4530108c2ddaa17813d1a2ddf53218fae6aec0d8814649e70c5c707db18b526fb94253af414f1faa599581604792bd77abb44b9aed
7
+ data.tar.gz: ce045ee0fa9049de87d9f9ad09acc0d4bac46b427d0f9fb9c87eed8d1b1cb42d014f6ce12be3273ef9251fc07a91222ec45060e28a9c9e3b22a9c5702a4344c2
@@ -298,7 +298,14 @@ module HybridPlatformsConductor
298
298
  def remote_copy(from, to, sudo: false, owner: nil, group: nil)
299
299
  if @nodes_handler.get_ssh_session_exec_of(@node) == 'false'
300
300
  # We don't have ExecSession, so don't use ssh, but scp instead.
301
- run_cmd "scp -S #{ssh_exec} #{from} #{ssh_url}:#{to}"
301
+ if sudo
302
+ # We need to first copy the file in an accessible directory, and then sudo mv
303
+ remote_bash('mkdir -p hpc_tmp_scp')
304
+ run_cmd "scp -S #{ssh_exec} #{from} #{ssh_url}:./hpc_tmp_scp"
305
+ remote_bash("#{@nodes_handler.sudo_on(@node)} mv ./hpc_tmp_scp/#{File.basename(from)} #{to}")
306
+ else
307
+ run_cmd "scp -S #{ssh_exec} #{from} #{ssh_url}:#{to}"
308
+ end
302
309
  else
303
310
  run_cmd <<~EOS
304
311
  cd #{File.dirname(from)} && \
@@ -154,7 +154,7 @@ module HybridPlatformsConductor
154
154
  hostname = "-#{Digest::MD5.hexdigest(hostname)[0..7]}.hpc-test.com"
155
155
  hostname = "#{@node}.#{@environment}"[0..MAX_PROXMOX_HOSTNAME_SIZE - hostname.size - 1] + hostname
156
156
  end
157
- @lxc_details = request_lxc_creation_for( {
157
+ @lxc_details = request_lxc_creation_for({
158
158
  ostemplate: pve_template,
159
159
  hostname: hostname.gsub('_', '-'),
160
160
  cores: min_resources_to_deploy[:cpus],
@@ -1,5 +1,5 @@
1
1
  module HybridPlatformsConductor
2
2
 
3
- VERSION = '32.11.2'
3
+ VERSION = '32.12.0'
4
4
 
5
5
  end
@@ -165,6 +165,39 @@ describe HybridPlatformsConductor::ActionsExecutor do
165
165
  end
166
166
  end
167
167
 
168
+ it 'copies files remotely without Session Exec capabilities and with sudo' do
169
+ with_test_platform_for_remote_testing(
170
+ expected_cmds: [
171
+ [/^\{ cat \| .+\/ssh hpc\.node -T; } <<'EOF'\nmkdir -p hpc_tmp_scp\nEOF$/, proc { [0, '', ''] }],
172
+ [
173
+ /^scp -S .+\/ssh \/path\/to\/src.file hpc\.node:\.\/hpc_tmp_scp$/,
174
+ proc { [0, '', ''] }
175
+ ],
176
+ [/^\{ cat \| .+\/ssh hpc\.node -T; } <<'EOF'\nsudo -u root mv \.\/hpc_tmp_scp\/src\.file \/remote_path\/to\/dst\.dir\nEOF$/, proc { [0, '', ''] }]
177
+ ],
178
+ session_exec: false
179
+ ) do
180
+ test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir', sudo: true)
181
+ end
182
+ end
183
+
184
+ it 'copies files remotely without Session Exec capabilities and with a different sudo' do
185
+ with_test_platform_for_remote_testing(
186
+ expected_cmds: [
187
+ [/^\{ cat \| .+\/ssh hpc\.node -T; } <<'EOF'\nmkdir -p hpc_tmp_scp\nEOF$/, proc { [0, '', ''] }],
188
+ [
189
+ /^scp -S .+\/ssh \/path\/to\/src.file hpc\.node:\.\/hpc_tmp_scp$/,
190
+ proc { [0, '', ''] }
191
+ ],
192
+ [/^\{ cat \| .+\/ssh hpc\.node -T; } <<'EOF'\nother_sudo --user root mv \.\/hpc_tmp_scp\/src\.file \/remote_path\/to\/dst\.dir\nEOF$/, proc { [0, '', ''] }]
193
+ ],
194
+ additional_config: 'sudo_for { |user| "other_sudo --user #{user}" }',
195
+ session_exec: false
196
+ ) do
197
+ test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir', sudo: true)
198
+ end
199
+ end
200
+
168
201
  end
169
202
 
170
203
  end
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: 32.11.2
4
+ version: 32.12.0
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-04-05 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: range_operators