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
@@ -97,7 +97,7 @@ class ProxmoxWaiter
97
97
  clean_up_done = false
98
98
  # Check if we can remove some expired ones
99
99
  @config['pve_nodes'].each do |pve_node|
100
- if api_get("nodes/#{pve_node}/lxc").any? { |lxc_info| is_vm_expired?(pve_node, Integer(lxc_info['vmid'])) }
100
+ if api_get("nodes/#{pve_node}/lxc").any? { |lxc_info| vm_expired?(pve_node, Integer(lxc_info['vmid'])) }
101
101
  destroy_expired_vms_on(pve_node)
102
102
  clean_up_done = true
103
103
  end
@@ -131,7 +131,7 @@ class ProxmoxWaiter
131
131
  # Select the best node, first keeping expired VMs if possible.
132
132
  # This is the index of the scores to be checked: if we can choose without recycling VMs, do it by considering score index 0.
133
133
  score_idx =
134
- if pve_node_scores.all? { |_pve_node, pve_node_scores| pve_node_scores[0].nil? }
134
+ if pve_node_scores.all? { |_pve_node, itr_pve_node_scores| itr_pve_node_scores[0].nil? }
135
135
  # No node was available without removing expired VMs.
136
136
  # Therefore we consider only scores without expired VMs.
137
137
  log 'No PVE node has enough free resources without removing eventual expired VMs'
@@ -139,12 +139,12 @@ class ProxmoxWaiter
139
139
  else
140
140
  0
141
141
  end
142
- selected_pve_node, selected_pve_node_score = pve_node_scores.inject([nil, nil]) do |(best_pve_node, best_score), (pve_node, pve_node_scores)|
143
- if pve_node_scores[score_idx].nil? ||
144
- (!best_score.nil? && pve_node_scores[score_idx] >= best_score)
142
+ selected_pve_node, selected_pve_node_score = pve_node_scores.inject([nil, nil]) do |(best_pve_node, best_score), (pve_node, itr_pve_node_scores)|
143
+ if itr_pve_node_scores[score_idx].nil? ||
144
+ (!best_score.nil? && itr_pve_node_scores[score_idx] >= best_score)
145
145
  [best_pve_node, best_score]
146
146
  else
147
- [pve_node, pve_node_scores[score_idx]]
147
+ [pve_node, itr_pve_node_scores[score_idx]]
148
148
  end
149
149
  end
150
150
  if selected_pve_node.nil?
@@ -201,26 +201,24 @@ class ProxmoxWaiter
201
201
  vm_id_str = vm_info['vm_id'].to_s
202
202
  # Destroy the VM ID
203
203
  # Find which PVE node hosts this VM
204
- unless @config['pve_nodes'].any? do |pve_node|
205
- api_get("nodes/#{pve_node}/lxc").any? do |lxc_info|
206
- if lxc_info['vmid'] == vm_id_str
207
- # Make sure this VM is still used for the node and environment we want.
208
- # It could have been deleted manually and re-affected to another node/environment automatically, and in this case we should not remove it.
209
- metadata = vm_metadata(pve_node, vm_info['vm_id'])
210
- if metadata[:node] == vm_info['node'] && metadata[:environment] == vm_info['environment']
211
- destroy_vm_on(pve_node, vm_info['vm_id'])
212
- found_pve_node = pve_node
213
- true
214
- else
215
- log "[ #{pve_node}/#{vm_info['vm_id']} ] - This container is not hosting the node/environment to be destroyed: #{metadata[:node]}/#{metadata[:environment]} != #{vm_info['node']}/#{vm_info['environment']}"
216
- false
217
- end
204
+ log "Could not find any PVE node hosting VM #{vm_info['vm_id']}" unless @config['pve_nodes'].any? do |pve_node|
205
+ api_get("nodes/#{pve_node}/lxc").any? do |lxc_info|
206
+ if lxc_info['vmid'] == vm_id_str
207
+ # Make sure this VM is still used for the node and environment we want.
208
+ # It could have been deleted manually and re-affected to another node/environment automatically, and in this case we should not remove it.
209
+ metadata = vm_metadata(pve_node, vm_info['vm_id'])
210
+ if metadata[:node] == vm_info['node'] && metadata[:environment] == vm_info['environment']
211
+ destroy_vm_on(pve_node, vm_info['vm_id'])
212
+ found_pve_node = pve_node
213
+ true
218
214
  else
215
+ log "[ #{pve_node}/#{vm_info['vm_id']} ] - This container is not hosting the node/environment to be destroyed: #{metadata[:node]}/#{metadata[:environment]} != #{vm_info['node']}/#{vm_info['environment']}"
219
216
  false
220
217
  end
218
+ else
219
+ false
221
220
  end
222
221
  end
223
- log "Could not find any PVE node hosting VM #{vm_info['vm_id']}"
224
222
  end
225
223
  end
226
224
  reserved_resource = {}
@@ -286,10 +284,10 @@ class ProxmoxWaiter
286
284
  # We disappeared from the queue!
287
285
  log '[ Futex queue ] - !!! Somebody removed use from the queue. Add our PID back.'
288
286
  write_access_queue(queue_futex_file, access_queue + [pid])
289
- elsif idx == 0
287
+ elsif idx.zero?
290
288
  # Access granted
291
289
  log '[ Futex queue ] - Exclusive access granted'
292
- write_access_queue(queue_futex_file, access_queue[1..-1])
290
+ write_access_queue(queue_futex_file, access_queue[1..])
293
291
  retry_futex_queue = false
294
292
  else
295
293
  # Just check that the first PID still exists, otherwise remove it from the queue.
@@ -304,7 +302,7 @@ class ProxmoxWaiter
304
302
  end
305
303
  unless first_pid_exist
306
304
  log "[ Futex queue ] - !!! First PID #{first_pid} does not exist - remove it from the queue"
307
- write_access_queue(queue_futex_file, access_queue[1..-1])
305
+ write_access_queue(queue_futex_file, access_queue[1..])
308
306
  end
309
307
  end
310
308
  end
@@ -343,7 +341,7 @@ class ProxmoxWaiter
343
341
  # Get the list of PVE nodes by default
344
342
  @config['pve_nodes'] = nodes_info.map { |node_info| node_info['node'] } unless @config['pve_nodes']
345
343
  rescue
346
- raise "Unable to connect to Proxmox API #{@config['proxmox_api_url']} with user #{@proxmox_user}: #{$!}"
344
+ raise "Unable to connect to Proxmox API #{@config['proxmox_api_url']} with user #{@proxmox_user}: #{$ERROR_INFO}"
347
345
  end
348
346
  @expiration_date = Time.now.utc - @config['expiration_period_secs']
349
347
  log "Consider expiration date #{@expiration_date.strftime('%F %T')}"
@@ -372,8 +370,8 @@ class ProxmoxWaiter
372
370
  # * *disk_gb* (Integer): Wanted GB of disk
373
371
  # Result::
374
372
  # * Hash<String, [Float or nil, Float or nil]>: The set of 2 scores, per PVE node name
375
- def pve_scores_for(nbr_cpus, ram_mb, disk_gb)
376
- Hash[@config['pve_nodes'].map do |pve_node|
373
+ def pve_scores_for(_nbr_cpus, ram_mb, disk_gb)
374
+ @config['pve_nodes'].map do |pve_node|
377
375
  # Get some resource usages stats from the node directly
378
376
  status_info = api_get("nodes/#{pve_node}/status")
379
377
  load_average = status_info['loadavg'].map { |load_str| Float(load_str) }
@@ -393,13 +391,13 @@ class ProxmoxWaiter
393
391
  # Store the resources used by containers we can recycle in separate variables.
394
392
  expired_disk_gb_used = 0
395
393
  expired_ram_mb_used = 0
396
- found_vm_ids = api_get("nodes/#{pve_node}/lxc").map do |lxc_info|
394
+ api_get("nodes/#{pve_node}/lxc").each do |lxc_info|
397
395
  vm_id = Integer(lxc_info['vmid'])
398
396
  # Some times the Proxmox API returns maxdisk as a String (but not always) even if it is documented as Integer here: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc.
399
397
  # TODO: Remove the Integer conversion when Proxmox API will be fixed.
400
398
  lxc_disk_gb_used = Integer(lxc_info['maxdisk']) / (1024 * 1024 * 1024)
401
399
  lxc_ram_mb_used = lxc_info['maxmem'] / (1024 * 1024)
402
- if is_vm_expired?(pve_node, vm_id)
400
+ if vm_expired?(pve_node, vm_id)
403
401
  expired_disk_gb_used += lxc_disk_gb_used
404
402
  expired_ram_mb_used += lxc_ram_mb_used
405
403
  else
@@ -419,16 +417,12 @@ class ProxmoxWaiter
419
417
  # Otherwise, store the scores, taking into account coefficients to then choose among possible PVE nodes.
420
418
  [
421
419
  if expected_ram_percent_used <= @config['limits']['ram_percent_used_max'] &&
422
- expected_disk_percent_used <= @config['limits']['disk_percent_used_max']
420
+ expected_disk_percent_used <= @config['limits']['disk_percent_used_max']
423
421
  expected_ram_percent_used * @config['coeff_ram_consumption'] + expected_disk_percent_used * @config['coeff_disk_consumption']
424
- else
425
- nil
426
422
  end,
427
423
  if expected_ram_percent_used_without_expired <= @config['limits']['ram_percent_used_max'] &&
428
- expected_disk_percent_used_without_expired <= @config['limits']['disk_percent_used_max']
424
+ expected_disk_percent_used_without_expired <= @config['limits']['disk_percent_used_max']
429
425
  expected_ram_percent_used_without_expired * @config['coeff_ram_consumption'] + expected_disk_percent_used_without_expired * @config['coeff_disk_consumption']
430
- else
431
- nil
432
426
  end
433
427
  ]
434
428
  else
@@ -437,7 +431,7 @@ class ProxmoxWaiter
437
431
  [nil, nil]
438
432
  end
439
433
  ]
440
- end]
434
+ end.to_h
441
435
  end
442
436
 
443
437
  # Is a given VM expired?
@@ -447,7 +441,7 @@ class ProxmoxWaiter
447
441
  # * *vm_id* (Integer): The VM ID
448
442
  # Result::
449
443
  # * Boolean: Is the given VM expired?
450
- def is_vm_expired?(pve_node, vm_id)
444
+ def vm_expired?(pve_node, vm_id)
451
445
  if vm_id.between?(*@config['vm_ids_range'])
452
446
  # Get its reservation date from the notes
453
447
  metadata = vm_metadata(pve_node, vm_id)
@@ -505,10 +499,10 @@ class ProxmoxWaiter
505
499
  if hpc_marker_idx.nil?
506
500
  {}
507
501
  else
508
- Hash[vm_description_lines[hpc_marker_idx + 1..-1].map do |line|
502
+ vm_description_lines[hpc_marker_idx + 1..].map do |line|
509
503
  property, value = line.split(': ')
510
504
  [property.to_sym, value]
511
- end]
505
+ end.to_h
512
506
  end
513
507
  end
514
508
 
@@ -536,7 +530,7 @@ class ProxmoxWaiter
536
530
  # Possible error codes returned are:
537
531
  # * *no_available_ip*: There is no available IP to be reserved
538
532
  # * *no_available_vm_id*: There is no available VM ID to be reserved
539
- def reserve_on(pve_node, nbr_cpus, ram_mb, disk_gb)
533
+ def reserve_on(pve_node, _nbr_cpus, _ram_mb, _disk_gb)
540
534
  # We select a new VM ID and VM IP.
541
535
  selected_vm_ip = free_ips.first
542
536
  if selected_vm_ip.nil?
@@ -563,10 +557,10 @@ class ProxmoxWaiter
563
557
  def destroy_expired_vms_on(pve_node)
564
558
  api_get("nodes/#{pve_node}/lxc").each do |lxc_info|
565
559
  vm_id = Integer(lxc_info['vmid'])
566
- destroy_vm_on(pve_node, vm_id) if is_vm_expired?(pve_node, vm_id)
560
+ destroy_vm_on(pve_node, vm_id) if vm_expired?(pve_node, vm_id)
567
561
  end
568
562
  # Invalidate the API cache for anything related to this PVE node
569
- pve_node_paths_regexp = /^nodes\/#{Regexp.escape(pve_node)}\/.+$/
563
+ pve_node_paths_regexp = %r{^nodes/#{Regexp.escape(pve_node)}/.+$}
570
564
  @gets_cache.delete_if { |path, _result| path =~ pve_node_paths_regexp }
571
565
  end
572
566
 
@@ -643,6 +637,7 @@ class ProxmoxWaiter
643
637
  # * *task* (String): The task ID
644
638
  def wait_for_proxmox_task(pve_node, task)
645
639
  raise "Invalid task: #{task}" if task[0..3] == 'NOK:'
640
+
646
641
  while task_status(pve_node, task) == 'running'
647
642
  log "[ #{pve_node} ] - Wait for Proxmox task #{task} to complete..."
648
643
  sleep 1
@@ -670,13 +665,14 @@ class ProxmoxWaiter
670
665
  # * *path* (String): API path to query
671
666
  # Result::
672
667
  # * Object: The API response
673
- def api_get(path, nbr_retries: 3, wait_between_retry_secs: 10)
668
+ def api_get(path)
674
669
  unless @gets_cache.key?(path)
675
670
  idx_try = 0
676
671
  loop do
677
672
  @gets_cache[path] = @proxmox.get(path)
678
673
  break unless @gets_cache[path].is_a?(String) && @gets_cache[path] =~ /^NOK: error code = 5\d\d$/
679
674
  raise "Proxmox API get #{path} returns #{@gets_cache[path]} continuously (tried #{idx_try + 1} times)" if idx_try >= @config['api_max_retries']
675
+
680
676
  idx_try += 1
681
677
  # We have to reauthenticate: error 500 raised by Proxmox are often due to token being invalidated wrongly
682
678
  # TODO: Provide a way to do it properly in the official gem
@@ -39,7 +39,6 @@ require 'json'
39
39
  reserved_resource = nil
40
40
 
41
41
  begin
42
-
43
42
  # As this script is meant to be run in an SSH session, make sure we automatically flush stdout/stderr.
44
43
  # Otherwise it will wait for the script completion before dumping everything, which is annoying as we want to track when it waits for hours.
45
44
  $stdout.sync = true
@@ -59,7 +58,7 @@ begin
59
58
  config_file = "#{__dir__}/config.json"
60
59
 
61
60
  OptionParser.new do |opts|
62
- opts.banner = "Usage: #{$0} [options]"
61
+ opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
63
62
  opts.on('-c', '--create FILE', 'Create a VM with the configuration stored in a given JSON file') do |file|
64
63
  create_info = JSON.parse(File.read(file))
65
64
  end
@@ -100,21 +99,18 @@ begin
100
99
  puts "[ #{Time.now.utc.strftime('%F %T')} ] - Destroy #{destroy_info} (attempt ##{idx_retry}/#{max_retries})"
101
100
  proxmox_waiter.destroy(destroy_info)
102
101
  end
103
- if reserved_resource.is_a?(Symbol)
104
- # We got an error (missing resources, IPs...).
105
- # Try again.
106
- puts "Could not perform the operation because of error: #{reserved_resource}. Waiting #{wait_time_before_retry_secs} seconds before trying again."
107
- reserved_resource = { error: reserved_resource }
108
- sleep wait_time_before_retry_secs
109
- else
110
- break
111
- end
102
+ break unless reserved_resource.is_a?(Symbol)
103
+
104
+ # We got an error (missing resources, IPs...).
105
+ # Try again.
106
+ puts "Could not perform the operation because of error: #{reserved_resource}. Waiting #{wait_time_before_retry_secs} seconds before trying again."
107
+ reserved_resource = { error: reserved_resource }
108
+ sleep wait_time_before_retry_secs
112
109
  idx_retry += 1
113
110
  end
114
-
115
111
  rescue
116
112
  reserved_resource = {
117
- error: "Unhandled exception from reserve_proxmox_container: #{$!}\n#{$!.backtrace.join("\n")}"
113
+ error: "Unhandled exception from reserve_proxmox_container: #{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}"
118
114
  }
119
115
  end
120
116
 
@@ -12,7 +12,7 @@ module HybridPlatformsConductor
12
12
  # Export in the Mediawiki format
13
13
  class Confluence < HybridPlatformsConductor::Report
14
14
 
15
- self.extend_config_dsl_with CommonConfigDsl::Confluence, :init_confluence
15
+ extend_config_dsl_with CommonConfigDsl::Confluence, :init_confluence
16
16
 
17
17
  # Give the list of supported locales by this report generator
18
18
  # [API] - This method is mandatory.
@@ -29,7 +29,7 @@ module HybridPlatformsConductor
29
29
  # Parameters::
30
30
  # * *nodes* (Array<String>): List of nodes
31
31
  # * *locale_code* (Symbol): The locale code
32
- def report_for(nodes, locale_code)
32
+ def report_for(nodes, _locale_code)
33
33
  confluence_info = @config.confluence_info
34
34
  if confluence_info
35
35
  if confluence_info[:inventory_report_page_id]
@@ -1,6 +1,9 @@
1
1
  require 'hybrid_platforms_conductor/report'
2
2
  require 'time'
3
3
 
4
+ # We use true/false as symbols on purpose for translations
5
+ # rubocop:disable Lint/BooleanSymbol
6
+
4
7
  module HybridPlatformsConductor
5
8
 
6
9
  module HpcPlugins
@@ -71,12 +74,12 @@ module HybridPlatformsConductor
71
74
  output = ''
72
75
  locale = TRANSLATIONS[locale_code]
73
76
 
74
- output << <<~EOS
77
+ output << <<~EO_MEDIAWIKI
75
78
  Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
76
79
 
77
80
  This page has been generated using <code>./bin/report --format mediawiki</code> on #{Time.now.utc.strftime('%F %T')} UTC.
78
81
 
79
- EOS
82
+ EO_MEDIAWIKI
80
83
 
81
84
  # Get all confs
82
85
  # Use the translations' keys to know all properties we want to display
@@ -84,7 +87,7 @@ module HybridPlatformsConductor
84
87
  @nodes_handler.prefetch_metadata_of nodes, locale.keys
85
88
  nodes.
86
89
  map do |node|
87
- { node: node }.merge(Hash[all_properties.map { |property| [property, @nodes_handler.metadata_of(node, property)] }])
90
+ { node: node }.merge(all_properties.map { |property| [property, @nodes_handler.metadata_of(node, property)] }.to_h)
88
91
  end.
89
92
  # Group them by physical / VMs
90
93
  group_by do |node_info|
@@ -116,22 +119,24 @@ module HybridPlatformsConductor
116
119
  output << "* '''#{node_info.delete(:node)}'''#{node_info[:private_ips].nil? || node_info[:private_ips].empty? ? '' : " - #{node_info[:private_ips].first}"} - #{node_info.delete(:description)}\n"
117
120
  node_info.delete(:private_ips) if !node_info[:private_ips].nil? && node_info[:private_ips].size == 1
118
121
  node_info.sort.each do |property, value|
119
- unless value.nil?
120
- raise "Missing translation of key: #{property}. Please edit TRANSLATIONS[:#{locale_code}]." unless locale.key?(property)
121
- formatted_value =
122
- if value.is_a?(Array)
123
- "\n#{value.map { |item| "::* #{item}" }.join("\n")}"
124
- elsif value.is_a?(Hash)
125
- "\n#{value.map { |item, value| "::* #{item}: #{value}" }.join("\n")}"
126
- elsif value.is_a?(TrueClass)
127
- locale[:true]
128
- elsif value.is_a?(FalseClass)
129
- locale[:false]
130
- else
131
- value.to_str
132
- end
133
- output << ": #{locale[property]}: #{formatted_value}\n"
134
- end
122
+ next if value.nil?
123
+
124
+ raise "Missing translation of key: #{property}. Please edit TRANSLATIONS[:#{locale_code}]." unless locale.key?(property)
125
+
126
+ output << ": #{locale[property]}: #{
127
+ case value
128
+ when Array
129
+ "\n#{value.map { |item| "::* #{item}" }.join("\n")}"
130
+ when Hash
131
+ "\n#{value.map { |item, item_value| "::* #{item}: #{item_value}" }.join("\n")}"
132
+ when TrueClass
133
+ locale[:true]
134
+ when FalseClass
135
+ locale[:false]
136
+ else
137
+ value.to_str
138
+ end
139
+ }\n"
135
140
  end
136
141
  output << "\n\n"
137
142
  end
@@ -139,7 +144,7 @@ module HybridPlatformsConductor
139
144
  end
140
145
  end
141
146
 
142
- output << <<~EOS
147
+ output << <<~EO_MEDIAWIKI
143
148
  Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
144
149
 
145
150
  [[Category:My Project]]
@@ -150,7 +155,7 @@ module HybridPlatformsConductor
150
155
  [[Category:Server]]
151
156
  [[Category:Configuration]]
152
157
  [[Category:Chef]]
153
- EOS
158
+ EO_MEDIAWIKI
154
159
 
155
160
  out output
156
161
  end
@@ -162,3 +167,5 @@ module HybridPlatformsConductor
162
167
  end
163
168
 
164
169
  end
170
+
171
+ # rubocop:enable Lint/BooleanSymbol
@@ -25,31 +25,35 @@ module HybridPlatformsConductor
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
  @nodes_handler.prefetch_metadata_of nodes, %i[hostname host_ip physical image description services]
30
- out(Terminal::Table.new(headings: [
31
- 'Node',
32
- 'Platform',
33
- 'Host name',
34
- 'IP',
35
- 'Physical?',
36
- 'OS',
37
- 'Description',
38
- 'Services'
39
- ]) do |table|
40
- nodes.sort.each do |node|
41
- table << [
42
- node,
43
- @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name,
44
- @nodes_handler.get_hostname_of(node),
45
- @nodes_handler.get_host_ip_of(node),
46
- @nodes_handler.get_physical_of(node) ? 'Yes' : 'No',
47
- @nodes_handler.get_image_of(node),
48
- @nodes_handler.get_description_of(node),
49
- (@nodes_handler.get_services_of(node) || []).sort.join(', ')
30
+ out(
31
+ Terminal::Table.new(
32
+ headings: [
33
+ 'Node',
34
+ 'Platform',
35
+ 'Host name',
36
+ 'IP',
37
+ 'Physical?',
38
+ 'OS',
39
+ 'Description',
40
+ 'Services'
50
41
  ]
42
+ ) do |table|
43
+ nodes.sort.each do |node|
44
+ table << [
45
+ node,
46
+ @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name,
47
+ @nodes_handler.get_hostname_of(node),
48
+ @nodes_handler.get_host_ip_of(node),
49
+ @nodes_handler.get_physical_of(node) ? 'Yes' : 'No',
50
+ @nodes_handler.get_image_of(node),
51
+ @nodes_handler.get_description_of(node),
52
+ (@nodes_handler.get_services_of(node) || []).sort.join(', ')
53
+ ]
54
+ end
51
55
  end
52
- end)
56
+ )
53
57
  end
54
58
 
55
59
  end
@@ -18,8 +18,8 @@ module HybridPlatformsConductor
18
18
  # * *cmd_runner* (CmdRunner): CmdRunner to be used. [default: CmdRunner.new]
19
19
  # * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
20
20
  def initialize(
21
- logger: Logger.new(STDOUT),
22
- logger_stderr: Logger.new(STDERR),
21
+ logger: Logger.new($stdout),
22
+ logger_stderr: Logger.new($stderr),
23
23
  config: Config.new,
24
24
  cmd_runner: CmdRunner.new,
25
25
  nodes_handler: NodesHandler.new
@@ -51,15 +51,17 @@ module HybridPlatformsConductor
51
51
  # * *service* (String): Service to be deployed
52
52
  # Result::
53
53
  # * Hash: The secrets
54
- def secrets_for(node, service)
54
+ def secrets_for(_node, _service)
55
55
  # As we are dealing with global secrets, cache the reading for performance between nodes and services.
56
56
  unless defined?(@secrets)
57
57
  @secrets = {}
58
58
  @secrets_files.each do |secrets_file|
59
59
  raise "Missing secrets file: #{secrets_file}" unless File.exist?(secrets_file)
60
- @secrets.merge!(JSON.parse(File.read(secrets_file))) do |key, value1, value2|
61
- raise "Secret #{key} has conflicting values between different secret JSON files." if value1 != value2
62
- value1
60
+
61
+ @secrets.merge!(JSON.parse(File.read(secrets_file))) do |key, value_1, value_2|
62
+ raise "Secret #{key} has conflicting values between different secret JSON files." if value_1 != value_2
63
+
64
+ value_1
63
65
  end
64
66
  end
65
67
  end