hybrid_platforms_conductor 32.4.0 → 32.7.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 +4 -4
- data/bin/nodes_to_deploy +11 -5
- data/lib/hybrid_platforms_conductor/deployer.rb +9 -8
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +147 -68
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +6 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +7 -6
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +45 -1
- data/lib/hybrid_platforms_conductor/services_handler.rb +9 -13
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +57 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +68 -12
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +47 -9
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +10 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +25 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +1 -5
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +37 -9
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +14 -14
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +70 -11
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +2 -2
- metadata +12 -11
|
@@ -20,7 +20,7 @@ module HybridPlatformsConductorTest
|
|
|
20
20
|
#
|
|
21
21
|
# Parameters::
|
|
22
22
|
# * *services* (Hash<String, Array<String> >): Expected nodes that should be deployed, with their corresponding services [default: { 'node' => %w[service] }]
|
|
23
|
-
# * *sudo* (
|
|
23
|
+
# * *sudo* (String or nil): sudo supposed to be used, or nil if none [default: 'sudo -u root']
|
|
24
24
|
# * *check_mode* (Boolean): Are we testing in check mode? [default: @check_mode]
|
|
25
25
|
# * *mocked_deploy_result* (Hash or nil): Mocked result of the deployment actions, or nil to use the helper's default [default: nil]
|
|
26
26
|
# * *additional_expected_actions* (Array): Additional expected actions [default: []]
|
|
@@ -28,7 +28,7 @@ module HybridPlatformsConductorTest
|
|
|
28
28
|
# * *expect_actions_timeout* (Integer or nil): Expected timeout in actions, or nil for none [default: nil]
|
|
29
29
|
def expected_actions_for_deploy_on(
|
|
30
30
|
services: { 'node' => %w[service] },
|
|
31
|
-
sudo:
|
|
31
|
+
sudo: 'sudo -u root',
|
|
32
32
|
check_mode: @check_mode,
|
|
33
33
|
mocked_deploy_result: nil,
|
|
34
34
|
additional_expected_actions: [],
|
|
@@ -82,7 +82,7 @@ module HybridPlatformsConductorTest
|
|
|
82
82
|
# * *expect_prepare_for_deploy* (Boolean): Should we expect calls to prepare for deploy? [default: true]
|
|
83
83
|
# * *expect_connections_to_nodes* (Boolean): Should we expect connections to nodes? [default: true]
|
|
84
84
|
# * *expect_default_actions* (Boolean): Should we expect default actions? [default: true]
|
|
85
|
-
# * *expect_sudo* (
|
|
85
|
+
# * *expect_sudo* (String or nil): Expected sudo command, or nil if none [default: 'sudo -u root']
|
|
86
86
|
# * *expect_secrets* (Hash): Secrets to be expected during deployment [default: {}]
|
|
87
87
|
# * *expect_local_environment* (Boolean): Expected local environment flag [default: false]
|
|
88
88
|
# * *expect_additional_actions* (Array): Additional expected actions [default: []]
|
|
@@ -99,7 +99,7 @@ module HybridPlatformsConductorTest
|
|
|
99
99
|
expect_prepare_for_deploy: true,
|
|
100
100
|
expect_connections_to_nodes: true,
|
|
101
101
|
expect_default_actions: true,
|
|
102
|
-
expect_sudo:
|
|
102
|
+
expect_sudo: 'sudo -u root',
|
|
103
103
|
expect_secrets: {},
|
|
104
104
|
expect_local_environment: false,
|
|
105
105
|
expect_additional_actions: [],
|
|
@@ -201,12 +201,21 @@ module HybridPlatformsConductorTest
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
it 'deploys on 1 node using root' do
|
|
204
|
-
with_platform_to_deploy(expect_sudo:
|
|
204
|
+
with_platform_to_deploy(expect_sudo: nil) do
|
|
205
205
|
test_actions_executor.connector(:ssh).ssh_user = 'root'
|
|
206
206
|
expect(test_deployer.deploy_on('node')).to eq('node' => expected_deploy_result)
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
+
it 'deploys on 1 node using an alternate sudo' do
|
|
211
|
+
with_platform_to_deploy(
|
|
212
|
+
expect_sudo: 'other_sudo --user root',
|
|
213
|
+
additional_config: 'sudo_for { |user| "other_sudo --user #{user}" }'
|
|
214
|
+
) do
|
|
215
|
+
expect(test_deployer.deploy_on('node')).to eq('node' => expected_deploy_result)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
210
219
|
it 'deploys on 1 node using 1 secret' do
|
|
211
220
|
with_platform_to_deploy(expect_secrets: { 'secret1' => 'password1' }) do
|
|
212
221
|
test_deployer.secrets = [{ 'secret1' => 'password1' }]
|
|
@@ -227,9 +236,9 @@ module HybridPlatformsConductorTest
|
|
|
227
236
|
nodes_info: { nodes: { 'node' => { meta: { image: 'debian_9' }, services: %w[service] } } },
|
|
228
237
|
expect_local_environment: true,
|
|
229
238
|
expect_additional_actions: [
|
|
230
|
-
{ remote_bash: 'sudo apt update && sudo apt install -y ca-certificates' },
|
|
239
|
+
{ remote_bash: 'sudo -u root apt update && sudo -u root apt install -y ca-certificates' },
|
|
231
240
|
{
|
|
232
|
-
remote_bash: 'sudo update-ca-certificates',
|
|
241
|
+
remote_bash: 'sudo -u root update-ca-certificates',
|
|
233
242
|
scp: {
|
|
234
243
|
certs_dir => '/usr/local/share/ca-certificates',
|
|
235
244
|
:sudo => true
|
|
@@ -244,6 +253,31 @@ module HybridPlatformsConductorTest
|
|
|
244
253
|
end
|
|
245
254
|
end
|
|
246
255
|
|
|
256
|
+
it 'deploys on 1 node in local environment with certificates to install using hpc_certificates on Debian and an alternate sudo' do
|
|
257
|
+
with_certs_dir do |certs_dir|
|
|
258
|
+
with_platform_to_deploy(
|
|
259
|
+
nodes_info: { nodes: { 'node' => { meta: { image: 'debian_9' }, services: %w[service] } } },
|
|
260
|
+
expect_sudo: 'other_sudo --user root',
|
|
261
|
+
expect_local_environment: true,
|
|
262
|
+
expect_additional_actions: [
|
|
263
|
+
{ remote_bash: 'other_sudo --user root apt update && other_sudo --user root apt install -y ca-certificates' },
|
|
264
|
+
{
|
|
265
|
+
remote_bash: 'other_sudo --user root update-ca-certificates',
|
|
266
|
+
scp: {
|
|
267
|
+
certs_dir => '/usr/local/share/ca-certificates',
|
|
268
|
+
:sudo => true
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
additional_config: 'sudo_for { |user| "other_sudo --user #{user}" }'
|
|
273
|
+
) do
|
|
274
|
+
ENV['hpc_certificates'] = certs_dir
|
|
275
|
+
test_deployer.local_environment = true
|
|
276
|
+
expect(test_deployer.deploy_on('node')).to eq('node' => expected_deploy_result)
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
247
281
|
it 'deploys on 1 node with certificates to install using hpc_certificates on Debian but ignores them in non-local environment' do
|
|
248
282
|
with_certs_dir do |certs_dir|
|
|
249
283
|
with_platform_to_deploy(nodes_info: { nodes: { 'node' => { meta: { image: 'debian_9' }, services: %w[service] } } }) do
|
|
@@ -257,7 +291,7 @@ module HybridPlatformsConductorTest
|
|
|
257
291
|
with_certs_dir do |certs_dir|
|
|
258
292
|
with_platform_to_deploy(
|
|
259
293
|
nodes_info: { nodes: { 'node' => { meta: { image: 'debian_9' }, services: %w[service] } } },
|
|
260
|
-
expect_sudo:
|
|
294
|
+
expect_sudo: nil,
|
|
261
295
|
expect_local_environment: true,
|
|
262
296
|
expect_additional_actions: [
|
|
263
297
|
{ remote_bash: 'apt update && apt install -y ca-certificates' },
|
|
@@ -284,9 +318,9 @@ module HybridPlatformsConductorTest
|
|
|
284
318
|
nodes_info: { nodes: { 'node' => { meta: { image: 'centos_7' }, services: %w[service] } } },
|
|
285
319
|
expect_local_environment: true,
|
|
286
320
|
expect_additional_actions: [
|
|
287
|
-
{ remote_bash: 'sudo yum install -y ca-certificates' },
|
|
321
|
+
{ remote_bash: 'sudo -u root yum install -y ca-certificates' },
|
|
288
322
|
{
|
|
289
|
-
remote_bash: ['sudo update-ca-trust enable', 'sudo update-ca-trust extract'],
|
|
323
|
+
remote_bash: ['sudo -u root update-ca-trust enable', 'sudo -u root update-ca-trust extract'],
|
|
290
324
|
scp: {
|
|
291
325
|
"#{certs_dir}/test_cert.crt" => '/etc/pki/ca-trust/source/anchors',
|
|
292
326
|
:sudo => true
|
|
@@ -301,11 +335,36 @@ module HybridPlatformsConductorTest
|
|
|
301
335
|
end
|
|
302
336
|
end
|
|
303
337
|
|
|
338
|
+
it 'deploys on 1 node with certificates to install using hpc_certificates on CentOS and an alternate sudo' do
|
|
339
|
+
with_certs_dir do |certs_dir|
|
|
340
|
+
with_platform_to_deploy(
|
|
341
|
+
nodes_info: { nodes: { 'node' => { meta: { image: 'centos_7' }, services: %w[service] } } },
|
|
342
|
+
expect_sudo: 'other_sudo --user root',
|
|
343
|
+
expect_local_environment: true,
|
|
344
|
+
expect_additional_actions: [
|
|
345
|
+
{ remote_bash: 'other_sudo --user root yum install -y ca-certificates' },
|
|
346
|
+
{
|
|
347
|
+
remote_bash: ['other_sudo --user root update-ca-trust enable', 'other_sudo --user root update-ca-trust extract'],
|
|
348
|
+
scp: {
|
|
349
|
+
"#{certs_dir}/test_cert.crt" => '/etc/pki/ca-trust/source/anchors',
|
|
350
|
+
:sudo => true
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
additional_config: 'sudo_for { |user| "other_sudo --user #{user}" }'
|
|
355
|
+
) do
|
|
356
|
+
ENV['hpc_certificates'] = certs_dir
|
|
357
|
+
test_deployer.local_environment = true
|
|
358
|
+
expect(test_deployer.deploy_on('node')).to eq('node' => expected_deploy_result)
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
|
|
304
363
|
it 'deploys on 1 node with certificates to install using hpc_certificates on CentOS using root' do
|
|
305
364
|
with_certs_dir do |certs_dir|
|
|
306
365
|
with_platform_to_deploy(
|
|
307
366
|
nodes_info: { nodes: { 'node' => { meta: { image: 'centos_7' }, services: %w[service] } } },
|
|
308
|
-
expect_sudo:
|
|
367
|
+
expect_sudo: nil,
|
|
309
368
|
expect_local_environment: true,
|
|
310
369
|
expect_additional_actions: [
|
|
311
370
|
{ remote_bash: 'yum install -y ca-certificates' },
|
|
@@ -58,7 +58,7 @@ module HybridPlatformsConductorTest
|
|
|
58
58
|
#
|
|
59
59
|
# Parameters::
|
|
60
60
|
# * *content* (String): hpc_config.rb's content
|
|
61
|
-
# * Proc: Code called with the
|
|
61
|
+
# * Proc: Code called with the hpc_config.rb file created.
|
|
62
62
|
# * Parameters::
|
|
63
63
|
# * *hybrid_platforms_dir* (String): The hybrid-platforms directory
|
|
64
64
|
def with_platforms(content)
|
|
@@ -330,7 +330,7 @@ module HybridPlatformsConductorTest
|
|
|
330
330
|
expect(actions).to eq({
|
|
331
331
|
'node' => {
|
|
332
332
|
remote_bash: {
|
|
333
|
-
commands: "#{expected_sudo ? 'sudo -E ' : ''}./proxmox/reserve_proxmox_container --create ./proxmox/create/create_#{expected_file_id}.json --config ./proxmox/config/config_#{expected_file_id}.json",
|
|
333
|
+
commands: "#{expected_sudo ? 'sudo -u root -E ' : ''}./proxmox/reserve_proxmox_container --create ./proxmox/create/create_#{expected_file_id}.json --config ./proxmox/config/config_#{expected_file_id}.json",
|
|
334
334
|
env: {
|
|
335
335
|
'hpc_user_for_proxmox' => proxmox_user,
|
|
336
336
|
'hpc_password_for_proxmox' => proxmox_password,
|
|
@@ -382,7 +382,7 @@ module HybridPlatformsConductorTest
|
|
|
382
382
|
expect(actions).to eq({
|
|
383
383
|
'node' => {
|
|
384
384
|
remote_bash: {
|
|
385
|
-
commands: "#{expected_sudo ? 'sudo -E ' : ''}./proxmox/reserve_proxmox_container --destroy ./proxmox/destroy/destroy_#{expected_file_id}.json --config ./proxmox/config/config_#{expected_file_id}.json",
|
|
385
|
+
commands: "#{expected_sudo ? 'sudo -u root -E ' : ''}./proxmox/reserve_proxmox_container --destroy ./proxmox/destroy/destroy_#{expected_file_id}.json --config ./proxmox/config/config_#{expected_file_id}.json",
|
|
386
386
|
env: {
|
|
387
387
|
'hpc_user_for_proxmox' => proxmox_user,
|
|
388
388
|
'hpc_password_for_proxmox' => proxmox_password,
|
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.7.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-
|
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: range_operators
|
|
@@ -281,20 +281,20 @@ description: Provides a complete toolset to help DevOps maintain, deploy, monito
|
|
|
281
281
|
email:
|
|
282
282
|
- muriel@x-aeon.com
|
|
283
283
|
executables:
|
|
284
|
-
- test
|
|
285
284
|
- topograph
|
|
286
|
-
-
|
|
285
|
+
- test
|
|
287
286
|
- free_veids
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
- deploy
|
|
287
|
+
- free_ips
|
|
288
|
+
- nodes_to_deploy
|
|
291
289
|
- last_deploys
|
|
290
|
+
- check-node
|
|
291
|
+
- run
|
|
292
|
+
- report
|
|
292
293
|
- get_impacted_nodes
|
|
293
294
|
- ssh_config
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
- free_ips
|
|
295
|
+
- deploy
|
|
296
|
+
- setup
|
|
297
|
+
- dump_nodes_json
|
|
298
298
|
extensions: []
|
|
299
299
|
extra_rdoc_files: []
|
|
300
300
|
files:
|
|
@@ -463,6 +463,7 @@ files:
|
|
|
463
463
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb
|
|
464
464
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb
|
|
465
465
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb
|
|
466
|
+
- spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb
|
|
466
467
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb
|
|
467
468
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb
|
|
468
469
|
- spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb
|