hybrid_platforms_conductor 32.11.2 → 32.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +8 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +1 -1
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +33 -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: d35b83051c7c0be0483d1c69eb3262d53ebf081f59b147160914eaef41fe4096
|
4
|
+
data.tar.gz: 7af2e0e2be5e1fe1cc1a34286003ca84889f40c6a356e36a0f84646e12570fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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],
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: range_operators
|