hybrid_platforms_conductor 33.0.0 → 33.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/check-node +0 -1
  4. data/bin/deploy +0 -1
  5. data/bin/get_impacted_nodes +0 -1
  6. data/bin/last_deploys +8 -7
  7. data/bin/nodes_to_deploy +2 -2
  8. data/bin/setup +6 -6
  9. data/bin/topograph +1 -1
  10. data/lib/hybrid_platforms_conductor/action.rb +4 -4
  11. data/lib/hybrid_platforms_conductor/actions_executor.rb +37 -42
  12. data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
  13. data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
  14. data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
  15. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
  16. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
  17. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
  18. data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +4 -3
  19. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
  20. data/lib/hybrid_platforms_conductor/config.rb +7 -4
  21. data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
  22. data/lib/hybrid_platforms_conductor/connector.rb +5 -2
  23. data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
  24. data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
  25. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
  26. data/lib/hybrid_platforms_conductor/deployer.rb +95 -96
  27. data/lib/hybrid_platforms_conductor/executable.rb +20 -15
  28. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
  29. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
  30. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
  31. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +6 -5
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +8 -6
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +7 -4
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +0 -1
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +19 -21
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +2 -3
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -2
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +2 -2
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +10 -9
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +2 -2
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +4 -6
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +25 -24
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
  74. data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
  75. data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
  76. data/lib/hybrid_platforms_conductor/log.rb +2 -2
  77. data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
  78. data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
  79. data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
  80. data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
  81. data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
  82. data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
  83. data/lib/hybrid_platforms_conductor/plugins.rb +13 -8
  84. data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
  85. data/lib/hybrid_platforms_conductor/report.rb +2 -2
  86. data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
  87. data/lib/hybrid_platforms_conductor/secrets_reader.rb +2 -2
  88. data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
  89. data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +1 -1
  90. data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
  91. data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
  92. data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
  93. data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
  94. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
  95. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
  96. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  97. data/spec/hybrid_platforms_conductor_test.rb +6 -6
  98. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +16 -11
  99. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
  100. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +23 -18
  101. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +67 -49
  102. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
  103. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +63 -50
  104. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +35 -35
  105. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
  106. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
  107. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
  108. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
  109. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
  110. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +73 -54
  111. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
  112. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
  113. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
  114. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +106 -91
  115. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
  116. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +10 -12
  117. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
  118. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
  119. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
  120. data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +7 -11
  121. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +34 -26
  122. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +21 -21
  123. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
  124. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
  125. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
  126. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
  127. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
  128. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
  129. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
  130. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
  131. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
  132. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
  133. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
  134. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
  135. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
  136. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
  137. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +21 -20
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +70 -55
  142. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
  143. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
  144. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
  145. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
  146. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
  147. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
  148. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
  149. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
  150. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
  151. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
  152. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
  153. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
  154. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
  155. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
  156. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
  157. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
  158. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
  159. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
  160. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
  161. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
  162. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
  163. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
  164. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
  165. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
  166. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
  167. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
  168. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
  169. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
  170. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +4 -3
  171. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
  172. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
  173. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
  174. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
  175. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
  176. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
  177. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +5 -5
  178. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
  179. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
  180. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
  181. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
  182. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
  183. data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
  184. data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
  185. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
  186. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
  187. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +13 -15
  188. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +289 -307
  189. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
  190. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
  191. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -9
  192. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -14
  193. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
  194. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
  195. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
  196. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
  197. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
  198. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
  199. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
  200. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
  201. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
  202. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
  203. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
  204. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
  205. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
  206. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +216 -14
  207. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
  208. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
  209. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
  210. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
  211. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
  212. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
  213. data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
  214. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
  215. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
  216. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
  217. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
  218. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
  219. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
  220. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
  221. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
  222. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
  223. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
  224. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
  225. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  226. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  227. data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
  228. data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
  229. data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +3 -1
  230. data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +3 -1
  231. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
  232. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
  233. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
  234. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
  236. data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +4 -4
  237. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
  238. data/spec/spec_helper.rb +17 -18
  239. data/tools/check_md +16 -20
  240. data/tools/generate_mermaid +1 -1
  241. metadata +43 -13
  242. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -1152
@@ -1,3 +1,4 @@
1
+ require 'English'
1
2
  require 'optparse'
2
3
  require 'logger'
3
4
  require 'hybrid_platforms_conductor/config'
@@ -43,8 +44,8 @@ module HybridPlatformsConductor
43
44
  parallel_options: true,
44
45
  timeout_options: true,
45
46
  deploy_options: true,
46
- logger: Logger.new(STDOUT, level: :info),
47
- logger_stderr: Logger.new(STDERR, level: :info),
47
+ logger: Logger.new($stdout, level: :info),
48
+ logger_stderr: Logger.new($stderr, level: :info),
48
49
  &opts_block
49
50
  )
50
51
  init_loggers(logger, logger_stderr)
@@ -92,11 +93,13 @@ module HybridPlatformsConductor
92
93
  # Result::
93
94
  # * Object: The corresponding component
94
95
  define_method(component) do
95
- @instantiated_components[component] = HybridPlatformsConductor.const_get(component.to_s.split('_').collect(&:capitalize).join.to_sym).new(
96
- logger: @logger,
97
- logger_stderr: @logger_stderr,
98
- **Hash[dependencies.map { |dependency| [dependency, send(dependency)] }]
99
- ) unless @instantiated_components.key?(component)
96
+ unless @instantiated_components.key?(component)
97
+ @instantiated_components[component] = HybridPlatformsConductor.const_get(component.to_s.split('_').collect(&:capitalize).join.to_sym).new(
98
+ logger: @logger,
99
+ logger_stderr: @logger_stderr,
100
+ **dependencies.map { |dependency| [dependency, send(dependency)] }.to_h
101
+ )
102
+ end
100
103
  @instantiated_components[component]
101
104
  end
102
105
 
@@ -107,7 +110,7 @@ module HybridPlatformsConductor
107
110
  # Handle common options (like logging and help).
108
111
  def parse_options!
109
112
  OptionParser.new do |opts|
110
- opts.banner = "Usage: #{$0} [options]"
113
+ opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
111
114
  opts.separator ''
112
115
  opts.separator 'Main options:'
113
116
  opts.on('-d', '--debug', 'Activate debug mode') do
@@ -117,17 +120,19 @@ module HybridPlatformsConductor
117
120
  out opts
118
121
  exit 0
119
122
  end
120
- @opts_block.call(opts) if @opts_block
123
+ @opts_block&.call(opts)
121
124
  nodes_handler.options_parse(opts) if nodes_handler_instantiated?
122
125
  nodes_handler.options_parse_nodes_selectors(opts, @selected_nodes) if @nodes_selection_options
123
126
  cmd_runner.options_parse(opts) if cmd_runner_instantiated?
124
127
  actions_executor.options_parse(opts, parallel: @parallel_options) if actions_executor_instantiated?
125
- deployer.options_parse(
126
- opts,
127
- parallel_switch: @parallel_options,
128
- timeout_options: @timeout_options,
129
- why_run_switch: @check_options
130
- ) if deployer_instantiated? && @deploy_options
128
+ if deployer_instantiated? && @deploy_options
129
+ deployer.options_parse(
130
+ opts,
131
+ parallel_switch: @parallel_options,
132
+ timeout_options: @timeout_options,
133
+ why_run_switch: @check_options
134
+ )
135
+ end
131
136
  json_dumper.options_parse(opts) if json_dumper_instantiated?
132
137
  reports_handler.options_parse(opts) if reports_handler_instantiated?
133
138
  tests_runner.options_parse(opts) if tests_runner_instantiated?
@@ -21,6 +21,8 @@ module HybridPlatformsConductor
21
21
  @nodes_metadata = []
22
22
  end
23
23
 
24
+ # As this is used in a DSL, keep the method as a setter using set_, otherwise it will be confused with simple variables if used like metadata =
25
+ # rubocop:disable Naming/AccessorMethodName
24
26
  # Set metadata associated to the nodes
25
27
  #
26
28
  # Parameters::
@@ -31,6 +33,7 @@ module HybridPlatformsConductor
31
33
  nodes_selectors_stack: current_nodes_selectors_stack
32
34
  }
33
35
  end
36
+ # rubocop:enable Naming/AccessorMethodName
34
37
 
35
38
  end
36
39
 
@@ -55,16 +58,16 @@ module HybridPlatformsConductor
55
58
  # Result::
56
59
  # * Hash<String, Hash<Symbol,Object> >: The corresponding properties, per required node.
57
60
  # Nodes for which the property can't be fetched can be ommitted.
58
- def get_others(nodes, metadata)
61
+ def get_others(nodes, _metadata)
59
62
  # Keep metadata values in a cache, per node
60
63
  @cached_metadata = {} unless defined?(@cached_metadata)
61
64
  nodes.each do |node|
62
- unless @cached_metadata.key?(node)
63
- @cached_metadata[node] = @nodes_handler.
64
- select_confs_for_node(node, @config.nodes_metadata).
65
- map { |nodes_metadata_info| nodes_metadata_info[:metadata] }.
66
- inject({}) { |merged_metadata, metadata| merged_metadata.merge(metadata) }
67
- end
65
+ next if @cached_metadata.key?(node)
66
+
67
+ @cached_metadata[node] = @nodes_handler.
68
+ select_confs_for_node(node, @config.nodes_metadata).
69
+ map { |nodes_metadata_info| nodes_metadata_info[:metadata] }.
70
+ inject({}) { |merged_metadata, node_metadata| merged_metadata.merge(node_metadata) }
68
71
  end
69
72
  @cached_metadata.slice(*nodes)
70
73
  end
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
39
39
  # Result::
40
40
  # * Hash<String, Object>: The corresponding property, per required node.
41
41
  # Nodes for which the property can't be fetched can be ommitted.
42
- def get_host_ip(nodes, metadata)
42
+ def get_host_ip(_nodes, metadata)
43
43
  updated_metadata = {}
44
44
  # Get the list of nodes, per hostname (just in case several nodes share the same hostname)
45
45
  # Hash<String, Array<String> >
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
39
39
  # Result::
40
40
  # * Hash<String, Object>: The corresponding property, per required node.
41
41
  # Nodes for which the property can't be fetched can be ommitted.
42
- def get_host_keys(nodes, metadata)
42
+ def get_host_keys(_nodes, metadata)
43
43
  updated_metadata = {}
44
44
  # Get the list of nodes, per hostname (just in case several nodes share the same hostname)
45
45
  # Hash<String, Array<String> >
@@ -89,7 +89,7 @@ module HybridPlatformsConductor
89
89
  log_to_stdout: log_debug?,
90
90
  no_exception: true
91
91
  )
92
- if exit_status == 0
92
+ if exit_status.zero?
93
93
  found_keys = []
94
94
  stdout.split("\n").each do |line|
95
95
  unless line =~ /^# .*$/
@@ -22,8 +22,8 @@ module HybridPlatformsConductor
22
22
  # Result::
23
23
  # * Hash<String, Object>: The corresponding property, per required node.
24
24
  # Nodes for which the property can't be fetched can be ommitted.
25
- def get_services(nodes, metadata)
26
- Hash[nodes.map { |node| [node, platform_for(node).services_for(node)] }]
25
+ def get_services(nodes, _metadata)
26
+ nodes.map { |node| [node, platform_for(node).services_for(node)] }.to_h
27
27
  end
28
28
 
29
29
  # Get other properties for a given set of nodes.
@@ -41,8 +41,8 @@ module HybridPlatformsConductor
41
41
  # Result::
42
42
  # * Hash<String, Hash<Symbol,Object> >: The corresponding properties, per required node.
43
43
  # Nodes for which the property can't be fetched can be ommitted.
44
- def get_others(nodes, metadata)
45
- Hash[nodes.map { |node| [node, platform_for(node).metadata_for(node)] }]
44
+ def get_others(nodes, _metadata)
45
+ nodes.map { |node| [node, platform_for(node).metadata_for(node)] }.to_h
46
46
  end
47
47
 
48
48
  private
@@ -53,6 +53,7 @@ module HybridPlatformsConductor
53
53
  system "cd #{workspace_for(@node)} ; /bin/bash"
54
54
  end
55
55
 
56
+ # rubocop:disable Lint/UnusedMethodArgument
56
57
  # Copy a file to the remote node in a directory
57
58
  # [API] - This method is mandatory
58
59
  # [API] - If defined, then with_connection_to has been called before this method.
@@ -74,6 +75,7 @@ module HybridPlatformsConductor
74
75
  to = "#{workspace_for(@node)}/#{to}" unless to.start_with?('/')
75
76
  FileUtils.cp_r from, to
76
77
  end
78
+ # rubocop:enable Lint/UnusedMethodArgument
77
79
 
78
80
  private
79
81
 
@@ -14,6 +14,7 @@ module HybridPlatformsConductor
14
14
  class NotConnectableError < RuntimeError
15
15
  end
16
16
 
17
+ # Config DSL extension
17
18
  module PlatformsDslSsh
18
19
 
19
20
  # List of SSH connection transformations:
@@ -59,6 +60,7 @@ module HybridPlatformsConductor
59
60
  # * *ssh_def_erb* (String): Corresponding SSH ERB configuration
60
61
  def gateway(gateway_conf, ssh_def_erb)
61
62
  raise "Gateway #{gateway_conf} already defined to #{@gateways[gateway_conf]}" if @gateways.key?(gateway_conf)
63
+
62
64
  @gateways[gateway_conf] = ssh_def_erb
63
65
  end
64
66
 
@@ -78,18 +80,18 @@ module HybridPlatformsConductor
78
80
  # Result::
79
81
  # * String: The corresponding SSH configuration
80
82
  def ssh_for_gateway(gateway_conf, variables = {})
81
- erb_context = self.clone
82
- def erb_context.get_binding
83
+ erb_context = clone
84
+ def erb_context.private_binding
83
85
  binding
84
86
  end
85
87
  variables.each do |var_name, var_value|
86
88
  erb_context.instance_variable_set("@#{var_name}".to_sym, var_value)
87
89
  end
88
- ERB.new(@gateways[gateway_conf]).result(erb_context.get_binding)
90
+ ERB.new(@gateways[gateway_conf]).result(erb_context.private_binding)
89
91
  end
90
92
 
91
93
  end
92
- self.extend_config_dsl_with PlatformsDslSsh, :init_ssh
94
+ extend_config_dsl_with PlatformsDslSsh, :init_ssh
93
95
 
94
96
  # Name of the gateway user to be used. [default: ENV['hpc_ssh_gateway_user'] or ubradm]
95
97
  # String
@@ -174,7 +176,7 @@ module HybridPlatformsConductor
174
176
  options_parser.on('-w', '--password', 'If used, then expect SSH connections to ask for a password.') do
175
177
  @auth_password = true
176
178
  end
177
- options_parser.on('-y', '--ssh-gateways-conf GATEWAYS_CONF', "Name of the gateways configuration to be used. Can also be set from environment variable hpc_ssh_gateways_conf.") do |gateway|
179
+ options_parser.on('-y', '--ssh-gateways-conf GATEWAYS_CONF', 'Name of the gateways configuration to be used. Can also be set from environment variable hpc_ssh_gateways_conf.') do |gateway|
178
180
  @ssh_gateways_conf = gateway.to_sym
179
181
  end
180
182
  end
@@ -185,6 +187,7 @@ module HybridPlatformsConductor
185
187
  # [API] - @nodes_handler can be used
186
188
  def validate_params
187
189
  raise 'No SSH user name specified. Please use --ssh-user option or hpc_ssh_user environment variable to set it.' if @ssh_user.nil? || @ssh_user.empty?
190
+
188
191
  known_gateways = @config.known_gateways
189
192
  raise "Unknown gateway configuration provided: #{@ssh_gateways_conf}. Possible values are: #{known_gateways.join(', ')}." if !@ssh_gateways_conf.nil? && !known_gateways.include?(@ssh_gateways_conf)
190
193
  end
@@ -212,13 +215,11 @@ module HybridPlatformsConductor
212
215
  # Parameters::
213
216
  # * *nodes* (Array<String>): Nodes to prepare the connection to
214
217
  # * *no_exception* (Boolean): Should we still continue if some nodes have connection errors? [default: false]
215
- # * Proc: Code called with the connections prepared.
218
+ # * *block* (Proc): Code called with the connections prepared.
216
219
  # * Parameters::
217
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)
218
- def with_connection_to(nodes, no_exception: false)
219
- with_ssh_master_to(nodes, no_exception: no_exception) do |connected_nodes|
220
- yield connected_nodes
221
- end
221
+ def with_connection_to(nodes, no_exception: false, &block)
222
+ with_ssh_master_to(nodes, no_exception: no_exception, &block)
222
223
  end
223
224
 
224
225
  # Integer: Max size for an argument that can be executed without getting through an intermediary file
@@ -251,7 +252,7 @@ module HybridPlatformsConductor
251
252
  temp_file = "#{Dir.tmpdir}/hpc_temp_cmds_#{Digest::MD5.hexdigest(bash_cmds)}.sh"
252
253
  File.open(temp_file, 'w+') do |file|
253
254
  file.write ssh_cmd
254
- file.chmod 0700
255
+ file.chmod 0o700
255
256
  end
256
257
  begin
257
258
  run_cmd(temp_file)
@@ -311,7 +312,7 @@ module HybridPlatformsConductor
311
312
  run_cmd "scp -S #{ssh_exec} #{from} #{ssh_url}:#{to}"
312
313
  end
313
314
  else
314
- run_cmd <<~EOS
315
+ run_cmd <<~EO_BASH
315
316
  cd #{File.dirname(from)} && \
316
317
  tar \
317
318
  --create \
@@ -329,7 +330,7 @@ module HybridPlatformsConductor
329
330
  --directory #{to} \
330
331
  --owner root \
331
332
  \"
332
- EOS
333
+ EO_BASH
333
334
  end
334
335
  end
335
336
 
@@ -358,7 +359,7 @@ module HybridPlatformsConductor
358
359
  # Result::
359
360
  # * String: The SSH config
360
361
  def ssh_config(ssh_exec: 'ssh', known_hosts_file: nil, nodes: @nodes_handler.known_nodes)
361
- config_content = <<~EOS
362
+ config_content = <<~EO_SSH_CONFIG
362
363
  ############
363
364
  # GATEWAYS #
364
365
  ############
@@ -369,7 +370,7 @@ module HybridPlatformsConductor
369
370
  # ENDPOINTS #
370
371
  #############
371
372
 
372
- EOS
373
+ EO_SSH_CONFIG
373
374
 
374
375
  # Add each node
375
376
  # Query for the metadata of all nodes at once
@@ -393,7 +394,7 @@ module HybridPlatformsConductor
393
394
  config_content << "\n"
394
395
  end
395
396
  # Add global definitions at the end of the SSH config, as they might be overriden by previous ones, and first match wins.
396
- config_content << <<~EOS
397
+ config_content << <<~EO_SSH_CONFIG
397
398
  ###########
398
399
  # GLOBALS #
399
400
  ###########
@@ -406,7 +407,7 @@ module HybridPlatformsConductor
406
407
  #{known_hosts_file.nil? ? '' : "UserKnownHostsFile #{known_hosts_file}"}
407
408
  #{@ssh_strict_host_key_checking ? '' : 'StrictHostKeyChecking no'}
408
409
 
409
- EOS
410
+ EO_SSH_CONFIG
410
411
  config_content
411
412
  end
412
413
 
@@ -421,7 +422,7 @@ module HybridPlatformsConductor
421
422
  cache_filled = defined?(@ssh_pass_installed)
422
423
  unless cache_filled
423
424
  exit_code, _stdout, _stderr = @cmd_runner.run_cmd 'sshpass -V', log_to_stdout: log_debug?, no_exception: true
424
- @ssh_pass_installed = (exit_code == 0)
425
+ @ssh_pass_installed = exit_code.zero?
425
426
  end
426
427
  @ssh_pass_installed
427
428
  end
@@ -518,12 +519,10 @@ module HybridPlatformsConductor
518
519
  # We'll do that using another terminal spawned in the background.
519
520
  if ENV['hpc_interactive'] == 'false'
520
521
  error = "Can't spawn interactive ControlMaster to #{node} in non-interactive mode. You may want to change the hpc_interactive env variable."
521
- if no_exception
522
- log_error error
523
- exit_status = :non_interactive
524
- else
525
- raise error
526
- end
522
+ raise error unless no_exception
523
+
524
+ log_error error
525
+ exit_status = :non_interactive
527
526
  else
528
527
  Thread.new do
529
528
  log_debug "[ ControlMaster - #{ssh_url} ] - Spawn interactive ControlMaster in separate terminal"
@@ -540,17 +539,14 @@ module HybridPlatformsConductor
540
539
  ssh_control_master_start_cmd = "#{ssh_exec}#{@passwords.key?(node) || @auth_password ? '' : ' -o BatchMode=yes'} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url} true"
541
540
  idx_try = 0
542
541
  loop do
543
- stderr = nil
544
542
  exit_status, _stdout, stderr = @cmd_runner.run_cmd ssh_control_master_start_cmd, log_to_stdout: log_debug?, no_exception: true, timeout: timeout
545
- if exit_status == 0
546
- break
547
- elsif stderr =~ /System is booting up/
543
+ break if exit_status.zero?
544
+
545
+ if stderr =~ /System is booting up/
548
546
  if idx_try == MAX_RETRIES_FOR_BOOT
549
- if no_exception
550
- break
551
- else
552
- raise ActionsExecutor::ConnectionError, "Tried #{idx_try} times to create SSH Control Master with #{ssh_control_master_start_cmd} but system says it's booting up."
553
- end
547
+ break if no_exception
548
+
549
+ raise ActionsExecutor::ConnectionError, "Tried #{idx_try} times to create SSH Control Master with #{ssh_control_master_start_cmd} but system says it's booting up."
554
550
  end
555
551
  # Wait a bit and try again
556
552
  idx_try += 1
@@ -563,7 +559,7 @@ module HybridPlatformsConductor
563
559
  end
564
560
  end
565
561
  end
566
- if exit_status == 0
562
+ if exit_status.zero?
567
563
  log_debug "[ ControlMaster - #{ssh_url} ] - ControlMaster created"
568
564
  working_master = true
569
565
  else
@@ -579,7 +575,7 @@ module HybridPlatformsConductor
579
575
  rescue CmdRunner::UnexpectedExitCodeError
580
576
  raise ActionsExecutor::ConnectionError, "Error while checking SSH Control Master with #{ssh_control_master_check_cmd}"
581
577
  end
582
- if exit_status == 0
578
+ if exit_status.zero?
583
579
  log_debug "[ ControlMaster - #{ssh_url} ] - ControlMaster checked ok"
584
580
  working_master = true
585
581
  else
@@ -597,17 +593,17 @@ module HybridPlatformsConductor
597
593
  end
598
594
  else
599
595
  # We have not created any ControlMaster, but still consider the nodes to be ready to connect
600
- user_locks = Hash[nodes.map { |node| [node, nil]} ]
596
+ user_locks = nodes.map { |node| [node, nil] }.to_h
601
597
  end
602
598
  yield user_locks.keys
603
599
  ensure
604
600
  if @ssh_use_control_master
605
601
  user_locks_mutex.synchronize do
606
602
  user_locks.each do |node, user_id|
607
- with_lock_on_control_master_for(node, user_id: user_id) do |current_users, user_id|
603
+ with_lock_on_control_master_for(node, user_id: user_id) do |current_users, current_user_id|
608
604
  ssh_url = "hpc.#{node}"
609
- log_warn "[ ControlMaster - #{ssh_url} ] - Current process/thread was not part of the ControlMaster users anymore whereas it should have been" unless current_users.include?(user_id)
610
- remaining_users = current_users - [user_id]
605
+ log_warn "[ ControlMaster - #{ssh_url} ] - Current process/thread was not part of the ControlMaster users anymore whereas it should have been" unless current_users.include?(current_user_id)
606
+ remaining_users = current_users - [current_user_id]
611
607
  if remaining_users.empty?
612
608
  # Stop the ControlMaster
613
609
  log_debug "[ ControlMaster - #{ssh_url} ] - Stopping ControlMaster..."
@@ -693,14 +689,15 @@ module HybridPlatformsConductor
693
689
  # * *nodes* (Array<String>): List of nodes for which we need the config to be created [default: @nodes_handler.known_nodes ]
694
690
  # * Proc: Code called with the given ssh executable to be used to get TI config
695
691
  def with_platforms_ssh(nodes: @nodes_handler.known_nodes)
696
- platforms_ssh_dir = Dir.mktmpdir("platforms_ssh_#{self.object_id}", @tmp_dir)
692
+ platforms_ssh_dir = Dir.mktmpdir("platforms_ssh_#{object_id}", @tmp_dir)
697
693
  log_debug "Generate temporary SSH configuration in #{platforms_ssh_dir} for #{nodes.size} nodes..."
698
694
  begin
699
695
  ssh_conf_file = "#{platforms_ssh_dir}/ssh_config"
700
696
  ssh_exec_file = "#{platforms_ssh_dir}/ssh"
701
697
  known_hosts_file = "#{platforms_ssh_dir}/known_hosts"
702
698
  raise 'sshpass is not installed. Can\'t use automatic passwords handling without it. Please install it.' if !@passwords.empty? && !ssh_pass_installed?
703
- File.open(ssh_exec_file, 'w+', 0700) do |file|
699
+
700
+ File.open(ssh_exec_file, 'w+', 0o700) do |file|
704
701
  file.puts "#!#{env_system_path} bash"
705
702
  # TODO: Make a mechanism that uses sshpass and the correct password only for the correct hostname (this requires parsing ssh parameters $*).
706
703
  # Current implementation is much simpler: it uses sshpass if at least 1 password is needed, and always uses the first password.
@@ -709,17 +706,17 @@ module HybridPlatformsConductor
709
706
  end
710
707
  File.write(ssh_conf_file, ssh_config(ssh_exec: ssh_exec_file, known_hosts_file: known_hosts_file, nodes: nodes))
711
708
  # Make sure all host keys are setup in the known hosts file
712
- File.open(known_hosts_file, 'w+', 0700) do |file|
709
+ File.open(known_hosts_file, 'w+', 0o700) do |file|
713
710
  if @ssh_strict_host_key_checking
714
711
  # In the case of an overriden connection, get host key for the overriden connection
715
712
  @nodes_handler.prefetch_metadata_of nodes, :host_keys
716
713
  nodes.sort.each do |node|
717
714
  host_keys = @nodes_handler.get_host_keys_of(node)
718
- if host_keys && !host_keys.empty?
719
- connection, _connection_user, _gateway, _gateway_user = connection_info_for(node)
720
- host_keys.each do |host_key|
721
- file.puts "#{connection} #{host_key}"
722
- end
715
+ next unless host_keys && !host_keys.empty?
716
+
717
+ connection, _connection_user, _gateway, _gateway_user = connection_info_for(node)
718
+ host_keys.each do |host_key|
719
+ file.puts "#{connection} #{host_key}"
723
720
  end
724
721
  end
725
722
  end
@@ -763,8 +760,6 @@ module HybridPlatformsConductor
763
760
  @nodes_handler.get_private_ips_of(node).first
764
761
  elsif @nodes_handler.get_hostname_of(node)
765
762
  @nodes_handler.get_hostname_of(node)
766
- else
767
- nil
768
763
  end
769
764
  connection_user = @ssh_user
770
765
  gateway = @nodes_handler.get_gateway_of node
@@ -775,6 +770,7 @@ module HybridPlatformsConductor
775
770
  connection, connection_user, gateway, gateway_user = transform_info[:transform].call(node, connection, connection_user, gateway, gateway_user)
776
771
  end
777
772
  raise NotConnectableError, "No connection possible to #{node}" if connection.nil? && !no_exception
773
+
778
774
  [connection, connection_user, gateway, gateway_user]
779
775
  end
780
776