hybrid_platforms_conductor 33.9.5 → 34.0.1

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.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +3 -1
  4. data/bin/free_veids +1 -1
  5. data/bin/get_impacted_nodes +1 -1
  6. data/bin/last_deploys +1 -1
  7. data/bin/nodes_to_deploy +3 -3
  8. data/docs/gen/mermaid/README.md-0.png +0 -0
  9. data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
  10. data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
  11. data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
  12. data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
  13. data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
  14. data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
  15. data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
  16. data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
  17. data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
  18. data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
  19. data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
  20. data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
  21. data/docs/tutorial/02_first_node.md +4 -4
  22. data/docs/tutorial/03_scale.md +4 -4
  23. data/docs/tutorial/05_extend_with_plugins.md +1 -0
  24. data/examples/tutorial/02_first_node/my-service-conf-repo/service_my-service.rb +4 -4
  25. data/examples/tutorial/03_scale/my-service-conf-repo/service_my-service.rb +4 -4
  26. data/examples/tutorial/03_scale/my-service-conf-repo/service_web-hello.rb +4 -4
  27. data/examples/tutorial/04_test/my-service-conf-repo/service_my-service.rb +4 -4
  28. data/examples/tutorial/04_test/my-service-conf-repo/service_web-hello.rb +4 -4
  29. data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_my-service.rb +4 -4
  30. data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_web-hello.rb +4 -4
  31. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/platform_handler/json_bash.rb +2 -2
  32. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb +1 -1
  33. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/my_hpc_plugins.gemspec +2 -1
  34. data/lib/hybrid_platforms_conductor/actions_executor.rb +2 -2
  35. data/lib/hybrid_platforms_conductor/cmd_runner.rb +4 -4
  36. data/lib/hybrid_platforms_conductor/config.rb +1 -0
  37. data/lib/hybrid_platforms_conductor/core_extensions/bundler/without_bundled_env.rb +3 -3
  38. data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +1 -0
  39. data/lib/hybrid_platforms_conductor/core_extensions/secret_string/colorize.rb +18 -0
  40. data/lib/hybrid_platforms_conductor/credentials.rb +1 -1
  41. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +3 -3
  42. data/lib/hybrid_platforms_conductor/deployer.rb +1 -1
  43. data/lib/hybrid_platforms_conductor/executable.rb +1 -1
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +2 -0
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -0
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +20 -18
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +3 -3
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +5 -5
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +13 -13
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +1 -1
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +6 -1
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +1 -1
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +3 -2
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +2 -2
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +6 -5
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +1 -0
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +1 -1
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +4 -3
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +1 -1
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +1 -1
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +5 -1
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +5 -1
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +5 -5
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +1 -1
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +2 -2
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +1 -1
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -2
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +1 -0
  69. data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
  70. data/lib/hybrid_platforms_conductor/logger_helpers.rb +8 -24
  71. data/lib/hybrid_platforms_conductor/nodes_handler.rb +8 -10
  72. data/lib/hybrid_platforms_conductor/parallel_threads.rb +3 -3
  73. data/lib/hybrid_platforms_conductor/platform_handler.rb +2 -2
  74. data/lib/hybrid_platforms_conductor/platforms_handler.rb +1 -1
  75. data/lib/hybrid_platforms_conductor/plugins.rb +2 -2
  76. data/lib/hybrid_platforms_conductor/provisioner.rb +1 -1
  77. data/lib/hybrid_platforms_conductor/services_handler.rb +6 -6
  78. data/lib/hybrid_platforms_conductor/test.rb +1 -1
  79. data/lib/hybrid_platforms_conductor/test_report.rb +4 -4
  80. data/lib/hybrid_platforms_conductor/tests_runner.rb +5 -3
  81. data/lib/hybrid_platforms_conductor/thycotic.rb +2 -2
  82. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +3 -3
  83. data/lib/hybrid_platforms_conductor/topographer.rb +3 -3
  84. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  85. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +2 -2
  86. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +2 -2
  87. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +3 -10
  88. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +19 -7
  89. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +2 -2
  90. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +2 -2
  91. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +2 -2
  92. data/spec/hybrid_platforms_conductor_test/api/credentials_spec.rb +13 -13
  93. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +2 -2
  94. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +2 -2
  95. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +1 -1
  96. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +9 -4
  97. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +1 -1
  98. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +2 -2
  99. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/keepass_spec.rb +2 -2
  100. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +2 -2
  101. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +1 -1
  102. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +3 -3
  103. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +1 -1
  104. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +2 -2
  105. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +2 -2
  106. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +5 -5
  107. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +1 -1
  108. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +3 -3
  109. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +1 -3
  110. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +11 -11
  111. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +5 -5
  112. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +2 -2
  113. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +1 -1
  114. data/spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb +3 -3
  115. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +3 -3
  116. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +2 -2
  117. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +2 -2
  118. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +2 -2
  119. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +2 -2
  120. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +2 -2
  121. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +3 -3
  122. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +2 -2
  123. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +2 -2
  124. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +2 -2
  125. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +17 -17
  126. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +4 -4
  127. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +2 -2
  128. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +1 -1
  129. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +33 -7
  130. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +7 -7
  131. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +2 -10
  132. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +1 -1
  133. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +7 -7
  134. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +2 -1
  135. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_3/recipes/35_unparsable_include.rb +3 -4
  136. data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +1 -1
  137. data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +1 -1
  138. data/spec/hybrid_platforms_conductor_test.rb +3 -2
  139. data/spec/spec_helper.rb +14 -0
  140. data/tools/generate_mermaid +1 -1
  141. metadata +185 -244
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03d8f9c77d6fd058348749c2ba567f905af52558207e281c8d20678775bfc85c
4
- data.tar.gz: 56ca17b26a52bee7cff5659718a283368270815e5e61f1bc4cae0201da1d39c8
3
+ metadata.gz: eceb3aaa78026b4b090ba7e30f2b9ba48db0888b3bdde1b6483185e03b1fe385
4
+ data.tar.gz: 72613e627adfa37271d2e14a5c2c6358c0a82a173b8b0bb40c3d9ebdb2ff9cde
5
5
  SHA512:
6
- metadata.gz: 6a97cab5245e2b0bcf27a869b783055560b3f0f95a70b3596fdba74fd64f4ddc41af715c54e66561ea59afdde83f382a5ff9e1fc05c9e85842276450e467cae9
7
- data.tar.gz: 521ea609ddc3952fbb924fb333f40901ed28396b575899c5dae2a43256c2e821162de13bb94a2c846817816205d062960590cc3088f3d0f6da74821103a62519
6
+ metadata.gz: e5fc0366dbcc380b695d87fd1dae6d5c7f73c21160610deb2fff95a2b49b9f6e8fe39b9eed7ce0b1c3705bcd12a8bb98ce8320e024147a7bf3d734555213ea70
7
+ data.tar.gz: 8baedbf10fe781d6da039abd9a97e350390ad33b835c15a366e8c17fcf8e3b53ae77c03b06b56203744245f9f43e86249b81dab07381beda2641934462b81a95
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # [v34.0.1](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v34.0.0...v34.0.1) (2026-12-04 10:12:18)
2
+
3
+ ### Patches
4
+
5
+ * [chore: update to Ruby 4, update dependencies, modernize pipeline with Codecov](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/a9e4f2080ee2f77692dc9698e089aba8c6ecd7c1)
6
+ * [chore: Fix Rubocop issues so that Ruby 4 migration gets easier to review](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/e35ebb53d0e07afc17b716591c781fb8940e6640)
7
+ * [fix(ssh): support multi-digit OpenSSH major versions](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/8102a9dc6aa512c5b75f1ddcf3a39bdff7f4cc5e)
8
+
9
+ # [v34.0.0](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.5...v34.0.0) (2025-04-25 22:44:39)
10
+
11
+ ### Patches
12
+
13
+ * [Fix NPM packages installation in Github workflows](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/5d18119b49ad7d0975d2c003139a394b9dd1116b)
14
+
15
+ ### Breaking changes
16
+
17
+ * [Migrate to Ruby 3](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/6e1b93a37b68b01b3144fe03ccc280e1275dd493)
18
+
1
19
  # [v33.9.5](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.4...v33.9.5) (2022-03-20 17:46:29)
2
20
 
3
21
  ### Patches
data/README.md CHANGED
@@ -96,7 +96,7 @@ Here are the various plugin categories:
96
96
  # Installation
97
97
 
98
98
  Installing Hybrid Platforms Conductor requires 2 steps:
99
- 1. Have **Ruby >= 2.5 and < 3.0** installed.
99
+ 1. Have **Ruby >= 3.0** installed.
100
100
  2. Install the `hybrid_platforms_conductor` Rubygem.
101
101
 
102
102
  See [installation details](docs/install.md) for more details on how to install those.
@@ -429,6 +429,8 @@ A subset of tests (or even a single test) can be run by using a part of their na
429
429
 
430
430
  To enable debugging logs during tests run, set the environment variable `TEST_DEBUG` to `1`: `TEST_DEBUG=1 bundle exec rspec -e "HybridPlatformsConductor::Deployer checking the docker images provisioning"`
431
431
 
432
+ Some tests depend on Docker and sshpass which should be installed separately if those tests are required to pass.
433
+
432
434
  ## License
433
435
 
434
436
  BSD license (details in the [LICENSE.md file](LICENSE.md)).
data/bin/free_veids CHANGED
@@ -11,7 +11,7 @@ executable.parse_options!
11
11
  nodes_handler.prefetch_metadata_of nodes_handler.known_nodes, :veid
12
12
  veids = nodes_handler.
13
13
  known_nodes.
14
- map { |node| nodes_handler.get_veid_of(node) ? nodes_handler.get_veid_of(node).to_i : nil }.
14
+ map { |node| nodes_handler.get_veid_of(node)&.to_i }.
15
15
  compact
16
16
 
17
17
  executable.out "Free VEIDs: #{([10_000] + veids).missing.rangify}"
@@ -38,5 +38,5 @@ executable.out "* #{impacted_services.size} impacted services:\n#{impacted_servi
38
38
  executable.out ''
39
39
  executable.out "* #{impacted_nodes.size} impacted nodes (directly):\n#{impacted_nodes.join("\n")}"
40
40
  executable.out ''
41
- executable.out "* #{all_impacted_nodes.size} impacted nodes (total#{smallest_set ? ' smallest set' : ''}):\n#{all_impacted_nodes.join("\n")}"
41
+ executable.out "* #{all_impacted_nodes.size} impacted nodes (total#{' smallest set' if smallest_set}):\n#{all_impacted_nodes.join("\n")}"
42
42
  executable.out ''
data/bin/last_deploys CHANGED
@@ -53,7 +53,7 @@ info_displayed = {
53
53
  error: 'Error'
54
54
  }
55
55
  executable.out(Terminal::Table.new(headings: info_displayed.values) do |table|
56
- sorted_deploy_info.each do |_node, deploy_info|
56
+ sorted_deploy_info.each do |(_node, deploy_info)|
57
57
  table << info_displayed.keys.map { |key| deploy_info[key] }
58
58
  end
59
59
  end)
data/bin/nodes_to_deploy CHANGED
@@ -68,9 +68,9 @@ unless ignore_deploy_info
68
68
  node_impacted = false
69
69
  # Loop over all possible repositories concerned by this deployment
70
70
  repo_idx = 0
71
- while node_deploy_info[:deployment_info].key?("repo_name_#{repo_idx}".to_sym)
72
- repo_name = node_deploy_info[:deployment_info]["repo_name_#{repo_idx}".to_sym]
73
- commit_id = node_deploy_info[:deployment_info]["commit_id_#{repo_idx}".to_sym]
71
+ while node_deploy_info[:deployment_info].key?(:"repo_name_#{repo_idx}")
72
+ repo_name = node_deploy_info[:deployment_info][:"repo_name_#{repo_idx}"]
73
+ commit_id = node_deploy_info[:deployment_info][:"commit_id_#{repo_idx}"]
74
74
  impacted_nodes = cache_impacted_nodes.dig(repo_name, commit_id)
75
75
  if impacted_nodes.nil?
76
76
  if platforms_handler.platform(repo_name)
Binary file
@@ -149,7 +149,7 @@ def check(node)
149
149
  # We first dump the wanted content in a temporary file and then we diff it.
150
150
  [
151
151
  {
152
- remote_bash: <<~EOS
152
+ remote_bash: <<~EO_BASH
153
153
  cat <<EOF >/tmp/my-service.conf.wanted
154
154
  #{wanted_conf_for(node)}
155
155
  EOF
@@ -160,7 +160,7 @@ def check(node)
160
160
  echo "Create file from scratch"
161
161
  cat /tmp/my-service.conf.wanted
162
162
  fi
163
- EOS
163
+ EO_BASH
164
164
  }
165
165
  ]
166
166
  end
@@ -176,10 +176,10 @@ def deploy(node)
176
176
  # And then we really deploy the file on our node.
177
177
  check(node) + [
178
178
  {
179
- remote_bash: <<~EOS
179
+ remote_bash: <<~EO_BASH
180
180
  mkdir -p ~/hpc_tutorial/node
181
181
  cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
182
- EOS
182
+ EO_BASH
183
183
  }
184
184
  ]
185
185
  end
@@ -443,7 +443,7 @@ def check(node)
443
443
  # We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
444
444
  [
445
445
  {
446
- remote_bash: <<~EOS
446
+ remote_bash: <<~EO_BASH
447
447
  echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
448
448
  echo Diffs on hello_world.txt:
449
449
  if test -f /root/hello_world.txt; then
@@ -452,7 +452,7 @@ def check(node)
452
452
  echo "Create hello_world.txt from scratch"
453
453
  cat /tmp/hello_world.txt.wanted
454
454
  fi
455
- EOS
455
+ EO_BASH
456
456
  }
457
457
  ]
458
458
  end
@@ -468,10 +468,10 @@ def deploy(node)
468
468
  # And then we really deploy the file on our node.
469
469
  check(node) + [
470
470
  {
471
- remote_bash: <<~EOS
471
+ remote_bash: <<~EO_BASH
472
472
  mkdir -p ~/hpc_tutorial/node
473
473
  cp /tmp/hello_world.txt.wanted /root/hello_world.txt
474
- EOS
474
+ EO_BASH
475
475
  }
476
476
  ]
477
477
  end
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.authors = ['Me myself!']
44
44
  s.email = ['me-myself@my-domain.com']
45
45
  s.summary = 'My awesome plugins for Hybrid Platforms Conductor'
46
+ s.required_ruby_version = '~> 4.0'
46
47
  s.files = Dir['{bin,lib,spec}/**/*']
47
48
  Dir['bin/**/*'].each do |exec_name|
48
49
  s.executables << File.basename(exec_name)
@@ -22,7 +22,7 @@ def check(node)
22
22
  # We first dump the wanted content in a temporary file and then we diff it.
23
23
  [
24
24
  {
25
- remote_bash: <<~EOS
25
+ remote_bash: <<~EO_BASH
26
26
  cat <<EOF >/tmp/my-service.conf.wanted
27
27
  #{wanted_conf_for(node)}
28
28
  EOF
@@ -33,7 +33,7 @@ def check(node)
33
33
  echo "Create file from scratch"
34
34
  cat /tmp/my-service.conf.wanted
35
35
  fi
36
- EOS
36
+ EO_BASH
37
37
  }
38
38
  ]
39
39
  end
@@ -49,10 +49,10 @@ def deploy(node)
49
49
  # And then we really deploy the file on our node.
50
50
  check(node) + [
51
51
  {
52
- remote_bash: <<~EOS
52
+ remote_bash: <<~EO_BASH
53
53
  mkdir -p ~/hpc_tutorial/node
54
54
  cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
55
- EOS
55
+ EO_BASH
56
56
  }
57
57
  ]
58
58
  end
@@ -22,7 +22,7 @@ def check(node)
22
22
  # We first dump the wanted content in a temporary file and then we diff it.
23
23
  [
24
24
  {
25
- remote_bash: <<~EOS
25
+ remote_bash: <<~EO_BASH
26
26
  cat <<EOF >/tmp/my-service.conf.wanted
27
27
  #{wanted_conf_for(node)}
28
28
  EOF
@@ -33,7 +33,7 @@ def check(node)
33
33
  echo "Create file from scratch"
34
34
  cat /tmp/my-service.conf.wanted
35
35
  fi
36
- EOS
36
+ EO_BASH
37
37
  }
38
38
  ]
39
39
  end
@@ -49,10 +49,10 @@ def deploy(node)
49
49
  # And then we really deploy the file on our node.
50
50
  check(node) + [
51
51
  {
52
- remote_bash: <<~EOS
52
+ remote_bash: <<~EO_BASH
53
53
  mkdir -p ~/hpc_tutorial/node
54
54
  cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
55
- EOS
55
+ EO_BASH
56
56
  }
57
57
  ]
58
58
  end
@@ -9,7 +9,7 @@ def check(node)
9
9
  # We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
10
10
  [
11
11
  {
12
- remote_bash: <<~EOS
12
+ remote_bash: <<~EO_BASH
13
13
  echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
14
14
  echo Diffs on hello_world.txt:
15
15
  if test -f /root/hello_world.txt; then
@@ -18,7 +18,7 @@ def check(node)
18
18
  echo "Create hello_world.txt from scratch"
19
19
  cat /tmp/hello_world.txt.wanted
20
20
  fi
21
- EOS
21
+ EO_BASH
22
22
  }
23
23
  ]
24
24
  end
@@ -34,10 +34,10 @@ def deploy(node)
34
34
  # And then we really deploy the file on our node.
35
35
  check(node) + [
36
36
  {
37
- remote_bash: <<~EOS
37
+ remote_bash: <<~EO_BASH
38
38
  mkdir -p ~/hpc_tutorial/node
39
39
  cp /tmp/hello_world.txt.wanted /root/hello_world.txt
40
- EOS
40
+ EO_BASH
41
41
  }
42
42
  ]
43
43
  end
@@ -22,7 +22,7 @@ def check(node)
22
22
  # We first dump the wanted content in a temporary file and then we diff it.
23
23
  [
24
24
  {
25
- remote_bash: <<~EOS
25
+ remote_bash: <<~EO_BASH
26
26
  cat <<EOF >/tmp/my-service.conf.wanted
27
27
  #{wanted_conf_for(node)}
28
28
  EOF
@@ -33,7 +33,7 @@ def check(node)
33
33
  echo "Create file from scratch"
34
34
  cat /tmp/my-service.conf.wanted
35
35
  fi
36
- EOS
36
+ EO_BASH
37
37
  }
38
38
  ]
39
39
  end
@@ -49,10 +49,10 @@ def deploy(node)
49
49
  # And then we really deploy the file on our node.
50
50
  check(node) + [
51
51
  {
52
- remote_bash: <<~EOS
52
+ remote_bash: <<~EO_BASH
53
53
  mkdir -p ~/hpc_tutorial/node
54
54
  cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
55
- EOS
55
+ EO_BASH
56
56
  }
57
57
  ]
58
58
  end
@@ -9,7 +9,7 @@ def check(node)
9
9
  # We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
10
10
  [
11
11
  {
12
- remote_bash: <<~EOS
12
+ remote_bash: <<~EO_BASH
13
13
  echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
14
14
  echo Diffs on hello_world.txt:
15
15
  if test -f /root/hello_world.txt; then
@@ -18,7 +18,7 @@ def check(node)
18
18
  echo "Create hello_world.txt from scratch"
19
19
  cat /tmp/hello_world.txt.wanted
20
20
  fi
21
- EOS
21
+ EO_BASH
22
22
  }
23
23
  ]
24
24
  end
@@ -34,10 +34,10 @@ def deploy(node)
34
34
  # And then we really deploy the file on our node.
35
35
  check(node) + [
36
36
  {
37
- remote_bash: <<~EOS
37
+ remote_bash: <<~EO_BASH
38
38
  mkdir -p ~/hpc_tutorial/node
39
39
  cp /tmp/hello_world.txt.wanted /root/hello_world.txt
40
- EOS
40
+ EO_BASH
41
41
  }
42
42
  ]
43
43
  end
@@ -22,7 +22,7 @@ def check(node)
22
22
  # We first dump the wanted content in a temporary file and then we diff it.
23
23
  [
24
24
  {
25
- remote_bash: <<~EOS
25
+ remote_bash: <<~EO_BASH
26
26
  cat <<EOF >/tmp/my-service.conf.wanted
27
27
  #{wanted_conf_for(node)}
28
28
  EOF
@@ -33,7 +33,7 @@ def check(node)
33
33
  echo "Create file from scratch"
34
34
  cat /tmp/my-service.conf.wanted
35
35
  fi
36
- EOS
36
+ EO_BASH
37
37
  }
38
38
  ]
39
39
  end
@@ -49,10 +49,10 @@ def deploy(node)
49
49
  # And then we really deploy the file on our node.
50
50
  check(node) + [
51
51
  {
52
- remote_bash: <<~EOS
52
+ remote_bash: <<~EO_BASH
53
53
  mkdir -p ~/hpc_tutorial/node
54
54
  cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
55
- EOS
55
+ EO_BASH
56
56
  }
57
57
  ]
58
58
  end
@@ -9,7 +9,7 @@ def check(node)
9
9
  # We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
10
10
  [
11
11
  {
12
- remote_bash: <<~EOS
12
+ remote_bash: <<~EO_BASH
13
13
  echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
14
14
  echo Diffs on hello_world.txt:
15
15
  if test -f /root/hello_world.txt; then
@@ -18,7 +18,7 @@ def check(node)
18
18
  echo "Create hello_world.txt from scratch"
19
19
  cat /tmp/hello_world.txt.wanted
20
20
  fi
21
- EOS
21
+ EO_BASH
22
22
  }
23
23
  ]
24
24
  end
@@ -34,10 +34,10 @@ def deploy(node)
34
34
  # And then we really deploy the file on our node.
35
35
  check(node) + [
36
36
  {
37
- remote_bash: <<~EOS
37
+ remote_bash: <<~EO_BASH
38
38
  mkdir -p ~/hpc_tutorial/node
39
39
  cp /tmp/hello_world.txt.wanted /root/hello_world.txt
40
- EOS
40
+ EO_BASH
41
41
  }
42
42
  ]
43
43
  end
@@ -75,7 +75,7 @@ module MyHpcPlugins
75
75
  # The use_why_run switch is on if the deployment should just be simulated.
76
76
  # Those actions (bash commands, scp of files, ruby code...) should be thread safe as they can be executed in parallel with other deployment actions for other nodes in case of a concurrent deployment on several nodes.
77
77
  # In our case it's very simple: we just call our bash script on the node's hostname.
78
- [{ bash: "#{repository_path}/install-#{service}.bash #{@nodes_handler.get_hostname_of(node)} #{use_why_run ? 'check' : ''}" }]
78
+ [{ bash: "#{repository_path}/install-#{service}.bash #{@nodes_handler.get_hostname_of(node)} #{'check' if use_why_run}" }]
79
79
  end
80
80
 
81
81
  # Parse stdout and stderr of a given deploy run and get the list of tasks with their status
@@ -91,7 +91,7 @@ module MyHpcPlugins
91
91
  # * *:changed*: The task has been changed
92
92
  # * *:identical*: The task has not been changed
93
93
  # * *diffs* (String): Differences, if any
94
- def parse_deploy_output(stdout, stderr)
94
+ def parse_deploy_output(stdout, _stderr)
95
95
  # In our case our bash scripts return the last line as a status, so use it.
96
96
  [{
97
97
  name: 'Install tool',
@@ -25,7 +25,7 @@ module MyHpcPlugins
25
25
  # Parameters::
26
26
  # * *nodes* (Array<String>): List of nodes
27
27
  # * *locale_code* (Symbol): The locale code
28
- def report_for(nodes, locale_code)
28
+ def report_for(_nodes, _locale_code)
29
29
  # This method simply provides a report for a given list of nodes in the desired locale.
30
30
  # The locale will be one of the supported ones.
31
31
  # Generate the report in a file to be uploaded on web10.
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'my_hpc_plugins'
3
3
  s.version = '0.0.1'
4
- s.date = '2021-04-29'
5
4
  s.authors = ['Me myself!']
6
5
  s.email = ['me-myself@my-domain.com']
7
6
  s.summary = 'My awesome plugins for Hybrid Platforms Conductor'
7
+ s.required_ruby_version = '~> 4.0'
8
8
  s.files = Dir['{bin,lib,spec}/**/*']
9
9
  Dir['bin/**/*'].each do |exec_name|
10
10
  s.executables << File.basename(exec_name)
@@ -12,4 +12,5 @@ Gem::Specification.new do |s|
12
12
  # Dependencies
13
13
  # Make sure we use a compatible version of hybrid_platforms_conductor
14
14
  s.add_dependency 'hybrid_platforms_conductor', '~> 32.12'
15
+ s.metadata['rubygems_mfa_required'] = 'true'
15
16
  end
@@ -156,7 +156,7 @@ module HybridPlatformsConductor
156
156
  end
157
157
  end
158
158
  accessible_nodes = actions_per_node.keys - missing_nodes
159
- log_debug "Running actions on #{accessible_nodes.size} nodes#{log_to_dir.nil? ? '' : " (logs dumped in #{log_to_dir})"}"
159
+ log_debug "Running actions on #{accessible_nodes.size} nodes#{" (logs dumped in #{log_to_dir})" unless log_to_dir.nil?}"
160
160
  # Prepare the result (stdout or nil per node)
161
161
  unless accessible_nodes.empty?
162
162
  # If we run in parallel then clone the connectors, so that each node has its own instance for thread-safe code.
@@ -270,7 +270,7 @@ module HybridPlatformsConductor
270
270
  if privileged_access?(node)
271
271
  ''
272
272
  else
273
- "#{@nodes_handler.sudo_on(node)} #{forward_env ? '-E ' : ''}"
273
+ "#{@nodes_handler.sudo_on(node)} #{'-E ' if forward_env}"
274
274
  end
275
275
  end
276
276
 
@@ -91,7 +91,7 @@ module HybridPlatformsConductor
91
91
  out cmd
92
92
  [expected_code.first, '', '']
93
93
  else
94
- log_debug "#{timeout.nil? ? '' : "[ Timeout #{timeout} ] - "}#{cmd.light_cyan.bold}"
94
+ log_debug "#{"[ Timeout #{timeout} ] - " unless timeout.nil?}#{cmd.light_cyan.bold}"
95
95
  exit_status = nil
96
96
  cmd_stdout = nil
97
97
  cmd_stderr = nil
@@ -148,11 +148,11 @@ module HybridPlatformsConductor
148
148
  rescue TTY::Command::TimeoutExceeded
149
149
  exit_status = :timeout
150
150
  cmd_stdout = cmd_result_stdout
151
- cmd_stderr = "#{cmd_result_stderr.empty? ? '' : "#{cmd_result_stderr}\n"}Timeout of #{timeout} triggered"
151
+ cmd_stderr = "#{"#{cmd_result_stderr}\n" unless cmd_result_stderr.empty?}Timeout of #{timeout} triggered"
152
152
  rescue
153
153
  exit_status = :command_error
154
154
  cmd_stdout = cmd_result_stdout
155
- cmd_stderr = "#{cmd_result_stderr.empty? ? '' : "#{cmd_result_stderr}\n"}#{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}"
155
+ cmd_stderr = "#{"#{cmd_result_stderr}\n" unless cmd_result_stderr.empty?}#{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}"
156
156
  ensure
157
157
  file_output&.close
158
158
  bash_file&.unlink
@@ -168,7 +168,7 @@ module HybridPlatformsConductor
168
168
  log_error error_title
169
169
  else
170
170
  # The exception won't contain stdout and stderr details (unless output to stdout was on), so dump them now
171
- log_error "#{error_title}#{log_to_stdout ? '' : "\n----- Command STDOUT:\n#{cmd_stdout}\n----- Command STDERR:\n#{cmd_stderr}"}"
171
+ log_error "#{error_title}#{"\n----- Command STDOUT:\n#{cmd_stdout}\n----- Command STDERR:\n#{cmd_stderr}" unless log_to_stdout}"
172
172
  raise exit_status == :timeout ? TimeoutError : UnexpectedExitCodeError, error_title
173
173
  end
174
174
  end
@@ -26,6 +26,7 @@ module HybridPlatformsConductor
26
26
  # * *init_method* (Symbol or nil): The initializer method of this Mixin, or nil if none [default = nil]
27
27
  def extend_config_dsl_with(mixin, init_method = nil)
28
28
  include mixin
29
+
29
30
  @mixin_initializers << init_method unless init_method.nil?
30
31
  mixin.instance_methods.each do |method_name|
31
32
  expose method_name unless method_name == init_method
@@ -4,13 +4,13 @@ module Bundler
4
4
  class << self
5
5
 
6
6
  # Run block with all bundler-related variables removed from the current environment
7
- def without_bundled_env(&block)
8
- with_env(current_unbundled_env, &block)
7
+ def without_bundled_env(&)
8
+ with_env(current_unbundled_env, &)
9
9
  end
10
10
 
11
11
  # @return [Hash] Environment with all bundler-related variables removed
12
12
  def current_unbundled_env
13
- env = ENV.clone.to_hash
13
+ env = ENV.to_h
14
14
  %w[
15
15
  PATH
16
16
  RUBYLIB
@@ -46,6 +46,7 @@ module Cleanroom
46
46
  # []
47
47
  # {:string=>"With to_hash"}
48
48
  KWARGS_TYPES = %i[key keyreq]
49
+ private_constant :KWARGS_TYPES
49
50
 
50
51
  #
51
52
  # The list of exposed methods with kwargs.
@@ -0,0 +1,18 @@
1
+ require 'colorize'
2
+ require 'secret_string'
3
+
4
+ # Add colorization methods to SecretString, but always directed to the silenced string as we NEVER want to modify/clone a secret.
5
+ class SecretString
6
+
7
+ extend Colorize::ClassMethods
8
+
9
+ def_delegators :@silenced_str, *%i[
10
+ colorize
11
+ uncolorize
12
+ colorized?
13
+ ]
14
+
15
+ color_methods
16
+ modes_methods
17
+
18
+ end
@@ -82,7 +82,7 @@ module HybridPlatformsConductor
82
82
 
83
83
  provider ||= proc do |requested_resource, requester|
84
84
  # Check environment variables
85
- user = ENV["hpc_user_for_#{id}"]
85
+ user = ENV.fetch("hpc_user_for_#{id}", nil)
86
86
  # Clone the password as we are going to treat it as a secret string that will be wiped out
87
87
  password = ENV["hpc_password_for_#{id}"].dup
88
88
  if user.nil? || user.empty? || password.nil? || password.empty?
@@ -21,13 +21,13 @@ module HybridPlatformsConductor
21
21
  # * *module_to_decorate* (Module): The module including the method to decorate
22
22
  # * *method_name* (Symbol): The method name to be decorated
23
23
  def self.decorate_method(module_to_decorate, method_name)
24
- original_method_name = "__hpc__#{method_name}__undecorated__".to_sym
24
+ original_method_name = :"__hpc__#{method_name}__undecorated__"
25
25
  module_to_decorate.alias_method original_method_name, method_name
26
- module_to_decorate.define_method(method_name) do |*args, &block|
26
+ module_to_decorate.define_method(method_name) do |*args, **kwargs, &block|
27
27
  result = nil
28
28
  CurrentDirMonitor.monitor.synchronize do
29
29
  # puts "TID #{Thread.current.object_id} from #{caller[2]} - Current dir monitor taken from #{Dir.pwd}"
30
- result = send(original_method_name, *args, &block)
30
+ result = send(original_method_name, *args, **kwargs, &block)
31
31
  # puts "TID #{Thread.current.object_id} from #{caller[2]} - Current dir monitor released back to #{Dir.pwd}"
32
32
  end
33
33
  result
@@ -288,7 +288,7 @@ module HybridPlatformsConductor
288
288
 
289
289
  # Check that we are allowed to deploy
290
290
  unless @use_why_run
291
- reason_for_interdiction = @services_handler.deploy_allowed?(
291
+ reason_for_interdiction = @services_handler.barrier_to_deploy(
292
292
  services: services_to_deploy,
293
293
  local_environment: @local_environment
294
294
  )
@@ -86,7 +86,7 @@ module HybridPlatformsConductor
86
86
  #
87
87
  # Result::
88
88
  # * Boolean: Has a singleton been instantiated for this component?
89
- define_method("#{component}_instantiated?".to_sym) do
89
+ define_method(:"#{component}_instantiated?") do
90
90
  @instantiated_components.key?(component)
91
91
  end
92
92
 
@@ -64,6 +64,8 @@ module HybridPlatformsConductor
64
64
  # Number of threads max to use for getent calls
65
65
  MAX_THREADS_GETENT = 32
66
66
 
67
+ private_constant :TIMEOUT_GETENT, :MAX_THREADS_GETENT
68
+
67
69
  # Discover the real IPs associated to a list of hosts.
68
70
  #
69
71
  # Parameters::
@@ -69,6 +69,8 @@ module HybridPlatformsConductor
69
69
  # Number of threads max to use for ssh-keyscan calls
70
70
  MAX_THREADS_SSH_KEY_SCAN = 32
71
71
 
72
+ private_constant :TIMEOUT_SSH_KEYSCAN, :MAX_THREADS_SSH_KEY_SCAN
73
+
72
74
  # Discover the host keys associated to a list of hosts.
73
75
  #
74
76
  # Parameters::