hybrid_platforms_conductor 34.0.0 → 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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/bin/get_impacted_nodes +1 -1
  4. data/docs/gen/mermaid/README.md-0.png +0 -0
  5. data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
  6. data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
  7. data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
  8. data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
  9. data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
  10. data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
  11. data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
  12. data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
  13. data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
  14. data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
  15. data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
  16. data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
  17. data/docs/tutorial/02_first_node.md +4 -4
  18. data/docs/tutorial/03_scale.md +4 -4
  19. data/docs/tutorial/05_extend_with_plugins.md +1 -0
  20. data/examples/tutorial/02_first_node/my-service-conf-repo/service_my-service.rb +4 -4
  21. data/examples/tutorial/03_scale/my-service-conf-repo/service_my-service.rb +4 -4
  22. data/examples/tutorial/03_scale/my-service-conf-repo/service_web-hello.rb +4 -4
  23. data/examples/tutorial/04_test/my-service-conf-repo/service_my-service.rb +4 -4
  24. data/examples/tutorial/04_test/my-service-conf-repo/service_web-hello.rb +4 -4
  25. data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_my-service.rb +4 -4
  26. data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_web-hello.rb +4 -4
  27. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/platform_handler/json_bash.rb +2 -2
  28. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb +1 -1
  29. data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/my_hpc_plugins.gemspec +2 -1
  30. data/lib/hybrid_platforms_conductor/actions_executor.rb +2 -2
  31. data/lib/hybrid_platforms_conductor/cmd_runner.rb +4 -4
  32. data/lib/hybrid_platforms_conductor/config.rb +1 -0
  33. data/lib/hybrid_platforms_conductor/core_extensions/bundler/without_bundled_env.rb +2 -2
  34. data/lib/hybrid_platforms_conductor/core_extensions/secret_string/colorize.rb +18 -0
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +13 -13
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +3 -3
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +3 -4
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +13 -13
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +6 -1
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +1 -1
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +2 -2
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +5 -5
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +1 -1
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +1 -1
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +1 -1
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +1 -1
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +5 -1
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +5 -1
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +1 -1
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -2
  51. data/lib/hybrid_platforms_conductor/json_dumper.rb +1 -1
  52. data/lib/hybrid_platforms_conductor/logger_helpers.rb +2 -18
  53. data/lib/hybrid_platforms_conductor/nodes_handler.rb +4 -4
  54. data/lib/hybrid_platforms_conductor/parallel_threads.rb +2 -2
  55. data/lib/hybrid_platforms_conductor/platform_handler.rb +1 -1
  56. data/lib/hybrid_platforms_conductor/plugins.rb +2 -2
  57. data/lib/hybrid_platforms_conductor/provisioner.rb +1 -1
  58. data/lib/hybrid_platforms_conductor/test.rb +1 -1
  59. data/lib/hybrid_platforms_conductor/tests_runner.rb +2 -3
  60. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +3 -3
  61. data/lib/hybrid_platforms_conductor/topographer.rb +1 -1
  62. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  63. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +2 -2
  64. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +2 -2
  65. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +18 -1
  66. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +2 -2
  67. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +2 -2
  68. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +2 -2
  69. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +2 -2
  70. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +2 -2
  71. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +6 -1
  72. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +1 -1
  73. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +2 -2
  74. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/keepass_spec.rb +1 -1
  75. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +2 -2
  76. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +2 -2
  77. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +3 -3
  78. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +1 -1
  79. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +2 -2
  80. data/spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb +3 -3
  81. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +3 -3
  82. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +2 -2
  83. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +2 -2
  84. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +2 -2
  85. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +2 -2
  86. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +2 -2
  87. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +2 -2
  88. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +2 -2
  89. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +2 -2
  90. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +2 -2
  91. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +17 -17
  92. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +4 -4
  93. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +2 -2
  94. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +1 -1
  95. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +30 -2
  96. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +4 -4
  97. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +1 -9
  98. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +1 -1
  99. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +3 -3
  100. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +2 -1
  101. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_3/recipes/35_unparsable_include.rb +1 -2
  102. data/spec/spec_helper.rb +14 -0
  103. data/tools/generate_mermaid +1 -1
  104. metadata +34 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4105038cdad3d70849816004ec2d909053e0e792900fc03e514d7b1ddc95d9c4
4
- data.tar.gz: 5bda67856370632895782f6271c4044c50c22b0f340d8fc36ec6e11d8ca8fd8f
3
+ metadata.gz: eceb3aaa78026b4b090ba7e30f2b9ba48db0888b3bdde1b6483185e03b1fe385
4
+ data.tar.gz: 72613e627adfa37271d2e14a5c2c6358c0a82a173b8b0bb40c3d9ebdb2ff9cde
5
5
  SHA512:
6
- metadata.gz: e5a2dee126aecde247f6143f0d047e23280778755cb01cfb8c94d3f74bb128259bdba6044b25213a3e06f91e25fce53d71a31d6afa9dd95b01b797a4906e6745
7
- data.tar.gz: f170805ef694bed86c8c673a3947b6c68755a27fba4ba79abebdf210dbf0ee39acb598466960f0eb3b387bb352dcc2b07094cca2e1f0d63b182eaa212d081926
6
+ metadata.gz: e5fc0366dbcc380b695d87fd1dae6d5c7f73c21160610deb2fff95a2b49b9f6e8fe39b9eed7ce0b1c3705bcd12a8bb98ce8320e024147a7bf3d734555213ea70
7
+ data.tar.gz: 8baedbf10fe781d6da039abd9a97e350390ad33b835c15a366e8c17fcf8e3b53ae77c03b06b56203744245f9f43e86249b81dab07381beda2641934462b81a95
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
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
+
1
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)
2
10
 
3
11
  ### Patches
@@ -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 ''
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,8 +4,8 @@ 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
@@ -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
@@ -218,8 +218,8 @@ module HybridPlatformsConductor
218
218
  # * *block* (Proc): Code called with the connections prepared.
219
219
  # * Parameters::
220
220
  # * *connected_nodes* (Array<String>): The list of connected nodes (should be equal to nodes unless no_exception == true and some nodes failed to connect)
221
- def with_connection_to(nodes, no_exception: false, &block)
222
- with_ssh_master_to(nodes, no_exception: no_exception, &block)
221
+ def with_connection_to(nodes, no_exception: false, &)
222
+ with_ssh_master_to(nodes, no_exception: no_exception, &)
223
223
  end
224
224
 
225
225
  # Integer: Max size for an argument that can be executed without getting through an intermediary file
@@ -328,12 +328,12 @@ module HybridPlatformsConductor
328
328
  --create \
329
329
  --gzip \
330
330
  --file - \
331
- #{owner.nil? ? '' : "--owner #{owner}"} \
332
- #{group.nil? ? '' : "--group #{group}"} \
331
+ #{"--owner #{owner}" unless owner.nil?} \
332
+ #{"--group #{group}" unless group.nil?} \
333
333
  #{File.basename(from)} | \
334
334
  #{ssh_exec} \
335
335
  #{ssh_url} \
336
- "#{need_sudo ? @actions_executor.sudo_prefix(@node) : ''}tar \
336
+ "#{@actions_executor.sudo_prefix(@node) if need_sudo}tar \
337
337
  --extract \
338
338
  --gunzip \
339
339
  --file - \
@@ -374,7 +374,7 @@ module HybridPlatformsConductor
374
374
  # GATEWAYS #
375
375
  ############
376
376
 
377
- #{@ssh_gateways_conf.nil? || !@config.known_gateways.include?(@ssh_gateways_conf) ? '' : @config.ssh_for_gateway(@ssh_gateways_conf, ssh_exec: ssh_exec, user: @ssh_user)}
377
+ #{@config.ssh_for_gateway(@ssh_gateways_conf, ssh_exec: ssh_exec, user: @ssh_user) unless @ssh_gateways_conf.nil? || !@config.known_gateways.include?(@ssh_gateways_conf)}
378
378
 
379
379
  #############
380
380
  # ENDPOINTS #
@@ -415,9 +415,9 @@ module HybridPlatformsConductor
415
415
  User #{@ssh_user}
416
416
  # Default control socket path to be used when multiplexing SSH connections
417
417
  ControlPath #{control_master_file('%h', '%p', '%r')}
418
- #{open_ssh_major_version >= 7 && open_ssh_major_version < 9 ? 'PubkeyAcceptedKeyTypes +ssh-dss' : ''}
419
- #{known_hosts_file.nil? ? '' : "UserKnownHostsFile #{known_hosts_file}"}
420
- #{@ssh_strict_host_key_checking ? '' : 'StrictHostKeyChecking no'}
418
+ #{'PubkeyAcceptedKeyTypes +ssh-dss' if open_ssh_major_version >= 7 && open_ssh_major_version < 9}
419
+ #{"UserKnownHostsFile #{known_hosts_file}" unless known_hosts_file.nil?}
420
+ #{'StrictHostKeyChecking no' unless @ssh_strict_host_key_checking}
421
421
 
422
422
  EO_SSH_CONFIG
423
423
  config_content
@@ -458,7 +458,7 @@ module HybridPlatformsConductor
458
458
  # Keep a cache of it.
459
459
  #
460
460
  # Result::
461
- # * String: The installed SSH major version
461
+ # * Integer: The installed SSH major version
462
462
  def open_ssh_major_version
463
463
  cache_filled = defined?(@open_ssh_major_version)
464
464
  unless cache_filled
@@ -468,7 +468,7 @@ module HybridPlatformsConductor
468
468
  log_debug 'Mock OpenSSH version because of dry-run mode'
469
469
  stdout = 'OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019'
470
470
  end
471
- @open_ssh_major_version = stdout.match(/^OpenSSH_(\d)\..+$/)[1].to_i
471
+ @open_ssh_major_version = stdout.match(/^OpenSSH_(\d+)\..+$/)[1].to_i
472
472
  end
473
473
  @open_ssh_major_version
474
474
  end
@@ -550,7 +550,7 @@ module HybridPlatformsConductor
550
550
  end
551
551
  else
552
552
  # Create the control master
553
- ssh_control_master_start_cmd = "#{ssh_exec}#{@passwords.key?(node) || @auth_password ? '' : ' -o BatchMode=yes'} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url} true"
553
+ ssh_control_master_start_cmd = "#{ssh_exec}#{' -o BatchMode=yes' unless @passwords.key?(node) || @auth_password} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url} true"
554
554
  idx_try = 0
555
555
  loop do
556
556
  exit_status, _stdout, stderr = @cmd_runner.run_cmd ssh_control_master_start_cmd, log_to_stdout: log_debug?, no_exception: true, timeout: timeout
@@ -716,7 +716,7 @@ module HybridPlatformsConductor
716
716
  # TODO: Make a mechanism that uses sshpass and the correct password only for the correct hostname (this requires parsing ssh parameters $*).
717
717
  # Current implementation is much simpler: it uses sshpass if at least 1 password is needed, and always uses the first password.
718
718
  # So far it is enough for our usage as we intend to use this only when deploying first time using root account, and all root accounts will have the same password.
719
- file.puts "#{@passwords.empty? ? '' : "sshpass -p#{@passwords.first[1]} "}ssh -F #{ssh_conf_file} $*"
719
+ file.puts "#{"sshpass -p#{@passwords.first[1]} " unless @passwords.empty?}ssh -F #{ssh_conf_file} $*"
720
720
  end
721
721
  File.write(ssh_conf_file, ssh_config(ssh_exec: ssh_exec_file, known_hosts_file: known_hosts_file, nodes: nodes))
722
722
  # Make sure all host keys are setup in the known hosts file
@@ -132,7 +132,7 @@ module HybridPlatformsConductor
132
132
  stdout_idx = stdout_lines.index(MARKER_STDOUT)
133
133
  stderr_idx = stdout_lines.index(MARKER_STDERR)
134
134
  deploy_info = {}
135
- stdout_lines[0..stdout_idx - 1].each do |line|
135
+ stdout_lines[0..(stdout_idx - 1)].each do |line|
136
136
  if line =~ /^([^:]+): (.+)$/
137
137
  key_str = Regexp.last_match(1)
138
138
  value = Regexp.last_match(2)
@@ -166,8 +166,8 @@ module HybridPlatformsConductor
166
166
  services: services,
167
167
  deployment_info: deploy_info,
168
168
  exit_status: exit_status =~ /^\d+$/ ? Integer(exit_status) : exit_status.to_sym,
169
- stdout: stdout_lines[stdout_idx + 1..stderr_idx - 1].join("\n"),
170
- stderr: stdout_lines[stderr_idx + 1..].join("\n")
169
+ stdout: stdout_lines[(stdout_idx + 1)..(stderr_idx - 1)].join("\n"),
170
+ stderr: stdout_lines[(stderr_idx + 1)..].join("\n")
171
171
  }
172
172
  end
173
173
  end
@@ -41,13 +41,12 @@ module HybridPlatformsConductor
41
41
  end
42
42
  end
43
43
  # Make sure we don't combine those 2 loops
44
- # rubocop:disable Style/CombinableLoops
44
+ # rubocop:disable-next Style/CombinableLoops
45
45
  @platform.deployable_services.each do |service|
46
46
  @platform.policy_run_list(service).each do |(_cookbook_dir, cookbook, recipe)|
47
47
  mark_recipe_used_by_policy(cookbook, recipe, service)
48
48
  end
49
49
  end
50
- # rubocop:enable Style/CombinableLoops
51
50
  @recipes_tree
52
51
  end
53
52
 
@@ -243,9 +242,9 @@ module HybridPlatformsConductor
243
242
  # * Parameters::
244
243
  # * *cookbook* (Symbol): Cookbook name
245
244
  # * *cookbook_dir* (String): Cookbook directory
246
- def for_each_cookbook(&block)
245
+ def for_each_cookbook(&)
247
246
  @platform.known_cookbook_paths.each do |cookbook_path|
248
- cookbooks_in(cookbook_path).each(&block)
247
+ cookbooks_in(cookbook_path).each(&)
249
248
  end
250
249
  end
251
250