hybrid_platforms_conductor 32.17.1 → 33.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +6 -3
  4. data/bin/check-node +0 -1
  5. data/bin/deploy +0 -1
  6. data/bin/get_impacted_nodes +0 -1
  7. data/bin/last_deploys +12 -8
  8. data/bin/nodes_to_deploy +6 -6
  9. data/bin/setup +6 -6
  10. data/bin/topograph +1 -1
  11. data/docs/config_dsl.md +45 -1
  12. data/docs/executables.md +6 -7
  13. data/docs/executables/check-node.md +3 -3
  14. data/docs/executables/deploy.md +3 -3
  15. data/docs/executables/dump_nodes_json.md +3 -3
  16. data/docs/executables/test.md +3 -3
  17. data/docs/executables/topograph.md +3 -3
  18. data/docs/gen/mermaid/README.md-0.png +0 -0
  19. data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
  20. data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
  21. data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
  22. data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
  23. data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
  24. data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
  25. data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
  26. data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
  27. data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
  28. data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
  29. data/docs/plugins.md +46 -0
  30. data/docs/plugins/log/remote_fs.md +26 -0
  31. data/docs/plugins/secrets_reader/cli.md +31 -0
  32. data/docs/plugins/secrets_reader/thycotic.md +46 -0
  33. data/lib/hybrid_platforms_conductor/action.rb +4 -4
  34. data/lib/hybrid_platforms_conductor/actions_executor.rb +45 -43
  35. data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
  36. data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
  37. data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
  38. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
  39. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
  40. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
  41. data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +4 -3
  42. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
  43. data/lib/hybrid_platforms_conductor/config.rb +8 -4
  44. data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
  45. data/lib/hybrid_platforms_conductor/connector.rb +5 -2
  46. data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +116 -0
  47. data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
  48. data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
  49. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
  50. data/lib/hybrid_platforms_conductor/deployer.rb +275 -225
  51. data/lib/hybrid_platforms_conductor/executable.rb +20 -15
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/log/my_log_plugin.rb.sample +100 -0
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +180 -0
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +119 -118
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +77 -0
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/my_secrets_reader_plugin.rb.sample +46 -0
  74. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +90 -0
  75. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
  76. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
  77. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -21
  78. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
  79. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
  80. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
  81. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +19 -21
  82. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
  83. data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +2 -3
  84. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
  85. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
  86. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
  87. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
  88. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
  89. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -2
  90. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +2 -2
  91. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +10 -9
  92. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +2 -2
  93. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
  94. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
  95. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +4 -6
  96. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
  97. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +25 -24
  98. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
  99. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
  100. data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
  101. data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
  102. data/lib/hybrid_platforms_conductor/log.rb +31 -0
  103. data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
  104. data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
  105. data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
  106. data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
  107. data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
  108. data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
  109. data/lib/hybrid_platforms_conductor/plugins.rb +14 -8
  110. data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
  111. data/lib/hybrid_platforms_conductor/report.rb +2 -2
  112. data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
  113. data/lib/hybrid_platforms_conductor/secrets_reader.rb +31 -0
  114. data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
  115. data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +1 -1
  116. data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
  117. data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
  118. data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
  119. data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
  120. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
  121. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
  122. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  123. data/spec/hybrid_platforms_conductor_test.rb +51 -12
  124. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +18 -11
  125. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +2 -2
  126. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +32 -21
  127. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +75 -49
  128. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +27 -15
  129. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +90 -59
  130. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +46 -44
  131. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
  132. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
  133. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
  134. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
  135. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
  136. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +106 -75
  137. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
  138. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
  139. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
  140. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +167 -142
  141. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
  142. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +16 -16
  143. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
  144. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
  145. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
  146. data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +43 -5
  147. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +199 -216
  148. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
  149. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
  150. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
  151. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
  152. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
  153. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
  154. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
  155. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
  156. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
  157. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
  158. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
  159. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
  160. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
  161. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
  162. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
  163. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
  164. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
  165. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
  166. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +64 -0
  167. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +268 -0
  168. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
  169. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
  170. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
  171. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
  172. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
  173. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
  174. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
  175. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
  176. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
  177. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
  178. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
  179. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
  180. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
  181. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
  182. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
  183. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
  184. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
  185. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
  186. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
  187. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
  188. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
  189. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
  190. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
  191. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
  192. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
  193. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
  194. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
  195. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
  196. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +5 -4
  197. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
  198. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
  199. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
  200. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
  201. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
  202. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
  203. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +5 -5
  204. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
  205. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
  206. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
  207. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
  208. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
  209. data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
  210. data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
  211. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
  212. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
  213. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +159 -113
  214. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +299 -160
  215. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
  216. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
  217. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -8
  218. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -196
  219. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
  220. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
  221. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
  222. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
  223. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
  224. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
  225. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
  226. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
  227. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
  228. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
  229. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
  230. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
  231. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
  232. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +245 -56
  233. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
  234. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
  235. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
  236. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
  237. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
  238. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
  239. data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
  240. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
  241. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
  242. 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
  243. 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
  244. 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
  245. 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
  246. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
  247. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
  248. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
  249. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
  250. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
  251. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  252. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  253. data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
  254. data/spec/hybrid_platforms_conductor_test/test_connector.rb +4 -3
  255. data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +84 -0
  256. data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +105 -0
  257. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
  258. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
  259. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
  260. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
  261. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
  262. data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +45 -0
  263. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
  264. data/spec/spec_helper.rb +17 -18
  265. data/tools/check_md +16 -20
  266. data/tools/generate_mermaid +1 -1
  267. metadata +194 -144
  268. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
@@ -1,5 +1,3 @@
1
- require 'thread'
2
-
3
1
  module HybridPlatformsConductor
4
2
 
5
3
  # Provide utilities to handle parallel threads
@@ -14,10 +12,10 @@ module HybridPlatformsConductor
14
12
  # * *parallel* (Boolean): Iterate in a multithreaded way? [default: false]
15
13
  # * *nbr_threads_max* (Integer or nil): Maximum number of threads to be used in case of parallel, or nil for no limit [default: nil]
16
14
  # * *progress* (String or nil): Name of a progress bar to follow the progression, or nil for no progress bar [default: 'Progress']
17
- # * Proc: The code called for each node being iterated on.
15
+ # * *block* (Proc): The code called for each node being iterated on.
18
16
  # * Parameters::
19
17
  # * *element* (Object): The object
20
- def for_each_element_in(list, parallel: false, nbr_threads_max: nil, progress: 'Process')
18
+ def for_each_element_in(list, parallel: false, nbr_threads_max: nil, progress: 'Process', &block)
21
19
  if parallel
22
20
  # Threads to wait for
23
21
  threads_to_join = []
@@ -46,6 +44,7 @@ module HybridPlatformsConductor
46
44
  pools[:processing] << element unless element.nil?
47
45
  end
48
46
  break if element.nil?
47
+
49
48
  begin
50
49
  yield element
51
50
  ensure
@@ -56,7 +55,7 @@ module HybridPlatformsConductor
56
55
  end
57
56
  end
58
57
  rescue
59
- log_error "Unhandled exception occurred in thread #{Thread.current.object_id}: #{$!}\n#{$!.backtrace.join("\n")}"
58
+ log_error "Unhandled exception occurred in thread #{Thread.current.object_id}: #{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}"
60
59
  raise
61
60
  end
62
61
  end
@@ -76,19 +75,16 @@ module HybridPlatformsConductor
76
75
  progress_bar.title = "Queue: #{nbr_to_process} - Processing: #{nbr_processing} - Done: #{nbr_processed} - Total: #{nbr_total}"
77
76
  progress_bar.progress = nbr_processed
78
77
  break if nbr_processed == nbr_total
78
+
79
79
  sleep 0.5
80
80
  end
81
81
  end
82
82
  end
83
83
  # Wait for threads to be joined
84
- threads_to_join.each do |thread|
85
- thread.join
86
- end
84
+ threads_to_join.each(&:join)
87
85
  else
88
86
  # Execute synchronously
89
- list.each do |element|
90
- yield element
91
- end
87
+ list.each(&block)
92
88
  end
93
89
  end
94
90
 
@@ -16,7 +16,7 @@ module HybridPlatformsConductor
16
16
  def self.inherited(subclass)
17
17
  # Make sure we define automatically a helper for such a platform
18
18
  mixin = Module.new
19
- platform_type = subclass.name.split('::').last.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase.to_sym
19
+ platform_type = subclass.name.split('::').last.gsub(/([a-z\d])([A-Z\d])/, '\1_\2').downcase.to_sym
20
20
  mixin.define_method("#{platform_type}_platform".to_sym) do |path: nil, git: nil, branch: 'master', &platform_config_code|
21
21
  repository_path =
22
22
  if !path.nil?
@@ -28,7 +28,7 @@ module HybridPlatformsConductor
28
28
  branch = "refs/heads/#{branch}" unless branch.include?('/')
29
29
  local_ref = "refs/remotes/origin/#{branch.split('/').last}"
30
30
  section "Cloning #{git} (#{branch} => #{local_ref}) into #{local_repository_path}" do
31
- git_repo = Git.init(local_repository_path, )
31
+ git_repo = Git.init(local_repository_path)
32
32
  git_repo.add_remote('origin', git).fetch(ref: "#{branch}:#{local_ref}")
33
33
  git_repo.checkout local_ref
34
34
  end
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
39
39
  end
40
40
  @platform_dirs[platform_type] = [] unless @platform_dirs.key?(platform_type)
41
41
  @platform_dirs[platform_type] << repository_path
42
- platform_config_code.call(repository_path) unless platform_config_code.nil?
42
+ platform_config_code&.call(repository_path)
43
43
  end
44
44
  # Register this new mixin in the Config DSL
45
45
  extend_config_dsl_with(mixin)
@@ -69,8 +69,8 @@ module HybridPlatformsConductor
69
69
  def initialize(
70
70
  platform_type,
71
71
  repository_path,
72
- logger: Logger.new(STDOUT),
73
- logger_stderr: Logger.new(STDERR),
72
+ logger: Logger.new($stdout),
73
+ logger_stderr: Logger.new($stderr),
74
74
  config: Config.new,
75
75
  cmd_runner: CmdRunner.new
76
76
  )
@@ -78,7 +78,7 @@ module HybridPlatformsConductor
78
78
  @platform_type = platform_type
79
79
  @repository_path = repository_path
80
80
  @cmd_runner = cmd_runner
81
- self.init if self.respond_to?(:init)
81
+ init if respond_to?(:init)
82
82
  end
83
83
 
84
84
  # Return the name of the platform
@@ -100,7 +100,7 @@ module HybridPlatformsConductor
100
100
  # * Array<String>: The list of nodes impacted by this diff
101
101
  # * Array<String>: The list of services impacted by this diff
102
102
  # * Boolean: Are there some files that have a global impact (meaning all nodes are potentially impacted by this diff)?
103
- def impacts_from(files_diffs)
103
+ def impacts_from(_files_diffs)
104
104
  # By default, consider all nodes of the platform are impacted by whatever diff.
105
105
  [
106
106
  [],
@@ -6,6 +6,7 @@ module HybridPlatformsConductor
6
6
  # Provide an API to access information given by Platform Handlers
7
7
  class PlatformsHandler
8
8
 
9
+ # Add some config DSL
9
10
  module ConfigDSLExtension
10
11
 
11
12
  # List of platforms repository directories, per platform type
@@ -32,8 +33,8 @@ module HybridPlatformsConductor
32
33
  # * *config* (Config): Config to be used. [default: Config.new]
33
34
  # * *cmd_runner* (CmdRunner): Command executor to be used. [default: CmdRunner.new]
34
35
  def initialize(
35
- logger: Logger.new(STDOUT),
36
- logger_stderr: Logger.new(STDERR),
36
+ logger: Logger.new($stdout),
37
+ logger_stderr: Logger.new($stderr),
37
38
  config: Config.new,
38
39
  cmd_runner: CmdRunner.new
39
40
  )
@@ -57,6 +58,7 @@ module HybridPlatformsConductor
57
58
  )
58
59
  # Check that this platform has unique name
59
60
  raise "Platform name #{platform_handler.name} is declared several times." if @platform_handlers.values.flatten.any? { |known_platform| known_platform.name == platform_handler.name }
61
+
60
62
  @platform_handlers[platform_type] = [] unless @platform_handlers.key?(platform_type)
61
63
  @platform_handlers[platform_type] << platform_handler
62
64
  end
@@ -78,7 +80,7 @@ module HybridPlatformsConductor
78
80
  # Result::
79
81
  # * Array<PlatformHandler>: List of platform handlers
80
82
  def known_platforms(platform_type: nil)
81
- (platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |platform_type| (@platform_handlers[platform_type] || []) }.flatten
83
+ (platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |search_platform_type| (@platform_handlers[search_platform_type] || []) }.flatten
82
84
  end
83
85
 
84
86
  # Return the platform handler for a given platform name
@@ -40,8 +40,8 @@ module HybridPlatformsConductor
40
40
  # * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
41
41
  # * *config* (Config): Config to be used. [default: Config.new]
42
42
  def initialize(
43
- logger: Logger.new(STDOUT),
44
- logger_stderr: Logger.new(STDERR),
43
+ logger: Logger.new($stdout),
44
+ logger_stderr: Logger.new($stderr),
45
45
  config: Config.new
46
46
  )
47
47
  init_loggers(logger, logger_stderr)
@@ -22,7 +22,7 @@ module HybridPlatformsConductor
22
22
  # * *parse_gems* (Boolean): Do we parse plugins from gems? [default: true]
23
23
  # * *logger* (Logger): Logger to be used [default = Logger.new(STDOUT)]
24
24
  # * *logger_stderr* (Logger): Logger to be used for stderr [default = Logger.new(STDERR)]
25
- def initialize(plugins_type, init_plugin: nil, parse_gems: true, logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR))
25
+ def initialize(plugins_type, init_plugin: nil, parse_gems: true, logger: Logger.new($stdout), logger_stderr: Logger.new($stderr))
26
26
  init_loggers(logger, logger_stderr)
27
27
  @plugins_type = plugins_type
28
28
  @init_plugin = init_plugin
@@ -37,7 +37,10 @@ module HybridPlatformsConductor
37
37
  def_delegators :@plugins, *%i[
38
38
  []
39
39
  each
40
+ each_key
41
+ each_value
40
42
  empty?
43
+ find
41
44
  key?
42
45
  keys
43
46
  select
@@ -71,15 +74,15 @@ module HybridPlatformsConductor
71
74
  # Register plugins by parsing gems
72
75
  def register_plugins_from_gems
73
76
  # Require all possible files that could define such a plugin, from all gems
74
- files_regexp = /lib\/(.*hpc_plugins\/#{Regexp.escape(@plugins_type.to_s)}\/[^\/]+)\.rb$/
77
+ files_regexp = %r{lib/(.*hpc_plugins/#{Regexp.escape(@plugins_type.to_s)}/[^/]+)\.rb$}
75
78
  Gem.loaded_specs.each do |gem_name, gem_specs|
76
79
  # Careful to not use gem_specs.files here as if your gem name contains "-" or other weird characters, files won't appear in the gemspec list.
77
80
  Dir.glob("#{gem_specs.full_gem_path}/lib/**/*.rb").each do |file|
78
- if file =~ files_regexp
79
- require_name = $1
80
- log_debug "[ #{@plugins_type} ] - Require from #{gem_name} file #{require_name}"
81
- require require_name
82
- end
81
+ next unless file =~ files_regexp
82
+
83
+ require_name = Regexp.last_match(1)
84
+ log_debug "[ #{@plugins_type} ] - Require from #{gem_name} file #{require_name}"
85
+ require require_name
83
86
  end
84
87
  end
85
88
  # Parse the registered classes to search for our plugins
@@ -89,10 +92,13 @@ module HybridPlatformsConductor
89
92
  # * have been defined by the requires (no unnamed class, as those can be created by clones when using concurrency),
90
93
  # * inherit from the base plugin class,
91
94
  # * have no descendants
95
+ # Careful: !(class_1 < class_2) != (class_1 >= class_2), so disable the cop here for inversions.
96
+ # rubocop:disable Style/InverseMethods
92
97
  if !klass.name.nil? && klass < ancestor_class && ObjectSpace.each_object(Class).all? { |other_klass| other_klass.name.nil? || !(other_klass < klass) }
93
- plugin_id = klass.name.split('::').last.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase.to_sym
98
+ plugin_id = klass.name.split('::').last.gsub(/([a-z\d])([A-Z\d])/, '\1_\2').downcase.to_sym
94
99
  self[plugin_id] = klass
95
100
  end
101
+ # rubocop:enable Style/InverseMethods
96
102
  end
97
103
  end
98
104
 
@@ -22,8 +22,8 @@ module HybridPlatformsConductor
22
22
  def initialize(
23
23
  node,
24
24
  environment: 'production',
25
- logger: Logger.new(STDOUT),
26
- logger_stderr: Logger.new(STDERR),
25
+ logger: Logger.new($stdout),
26
+ logger_stderr: Logger.new($stderr),
27
27
  config: Config.new,
28
28
  cmd_runner: CmdRunner.new,
29
29
  nodes_handler: NodesHandler.new,
@@ -80,7 +80,7 @@ module HybridPlatformsConductor
80
80
  @config.ssh_connection_transforms.replace(@config.ssh_connection_transforms.map do |ssh_transform_info|
81
81
  {
82
82
  nodes_selectors_stack: ssh_transform_info[:nodes_selectors_stack].map do |nodes_selector|
83
- @nodes_handler.select_nodes(nodes_selector).select { |selected_node| selected_node != @node }
83
+ @nodes_handler.select_nodes(nodes_selector).reject { |selected_node| selected_node == @node }
84
84
  end,
85
85
  transform: ssh_transform_info[:transform]
86
86
  }
@@ -154,7 +154,7 @@ module HybridPlatformsConductor
154
154
  begin
155
155
  Socket.tcp(instance_ip, port, connect_timeout: remaining_timeout) { true }
156
156
  rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT
157
- log_warn "[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{$!}"
157
+ log_warn "[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{$ERROR_INFO}"
158
158
  false
159
159
  end
160
160
  sleep 1 unless port_listening
@@ -15,8 +15,8 @@ module HybridPlatformsConductor
15
15
  # * *platforms_handler* (PlatformsHandler): Platforms handler to be used. [default: PlatformsHandler.new]
16
16
  # * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
17
17
  def initialize(
18
- logger: Logger.new(STDOUT),
19
- logger_stderr: Logger.new(STDERR),
18
+ logger: Logger.new($stdout),
19
+ logger_stderr: Logger.new($stderr),
20
20
  config: Config.new,
21
21
  platforms_handler: PlatformsHandler.new,
22
22
  nodes_handler: NodesHandler.new
@@ -26,8 +26,8 @@ module HybridPlatformsConductor
26
26
  # * *platforms_handler* (PlatformsHandler): Platforms handler to be used. [default = PlatformsHandler.new]
27
27
  # * *nodes_handler* (NodesHandler): Nodes handler to be used. [default = NodesHandler.new]
28
28
  def initialize(
29
- logger: Logger.new(STDOUT),
30
- logger_stderr: Logger.new(STDERR),
29
+ logger: Logger.new($stdout),
30
+ logger_stderr: Logger.new($stderr),
31
31
  config: Config.new,
32
32
  platforms_handler: PlatformsHandler.new,
33
33
  nodes_handler: NodesHandler.new
@@ -70,6 +70,7 @@ module HybridPlatformsConductor
70
70
  # * *nodes_selectors* (Array<Object>): List of nodes selectors to produce report for
71
71
  def produce_report_for(nodes_selectors)
72
72
  raise "Unknown locale for format #{@format}: #{@locale}" unless @reports_plugins[@format].supported_locales.include? @locale
73
+
73
74
  @reports_plugins[@format].new(
74
75
  logger: @logger,
75
76
  logger_stderr: @logger_stderr,
@@ -0,0 +1,31 @@
1
+ require 'hybrid_platforms_conductor/logger_helpers'
2
+ require 'hybrid_platforms_conductor/plugin'
3
+
4
+ module HybridPlatformsConductor
5
+
6
+ # Ancestor of all secrets reader plugins
7
+ class SecretsReader < Plugin
8
+
9
+ # Constructor
10
+ #
11
+ # Parameters::
12
+ # * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
13
+ # * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
14
+ # * *config* (Config): Config to be used. [default: Config.new]
15
+ # * *cmd_runner* (CmdRunner): CmdRunner to be used. [default: CmdRunner.new]
16
+ # * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
17
+ def initialize(
18
+ logger: Logger.new($stdout),
19
+ logger_stderr: Logger.new($stderr),
20
+ config: Config.new,
21
+ cmd_runner: CmdRunner.new,
22
+ nodes_handler: NodesHandler.new
23
+ )
24
+ super(logger: logger, logger_stderr: logger_stderr, config: config)
25
+ @cmd_runner = cmd_runner
26
+ @nodes_handler = nodes_handler
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -21,7 +21,8 @@ module HybridPlatformsConductor
21
21
 
22
22
  @packaged_deployments = []
23
23
 
24
- include LoggerHelpers, ParallelThreads
24
+ include ParallelThreads
25
+ include LoggerHelpers
25
26
 
26
27
  # Constructor
27
28
  #
@@ -34,8 +35,8 @@ module HybridPlatformsConductor
34
35
  # * *nodes_handler* (NodesHandler): Nodes Handler to be used. [default: NodesHandler.new]
35
36
  # * *actions_executor* (ActionsExecutor): Actions Executor to be used. [default: ActionsExecutor.new]
36
37
  def initialize(
37
- logger: Logger.new(STDOUT),
38
- logger_stderr: Logger.new(STDERR),
38
+ logger: Logger.new($stdout),
39
+ logger_stderr: Logger.new($stderr),
39
40
  config: Config.new,
40
41
  cmd_runner: CmdRunner.new,
41
42
  platforms_handler: PlatformsHandler.new,
@@ -56,13 +57,11 @@ module HybridPlatformsConductor
56
57
  #
57
58
  # Parameters::
58
59
  # * *services* (Hash< String, Array<String> >): Services to be deployed, per node
59
- # * *secrets* (Hash): Secrets to be used for deployment
60
60
  # * *local_environment* (Boolean): Are we deploying to a local environment?
61
61
  # Result::
62
62
  # * String or nil: Reason for which we are not allowed to deploy, or nil if deployment is authorized
63
63
  def deploy_allowed?(
64
64
  services:,
65
- secrets:,
66
65
  local_environment:
67
66
  )
68
67
  if local_environment
@@ -83,7 +82,7 @@ module HybridPlatformsConductor
83
82
  head_commit_id = git.log.first.sha
84
83
  git.branches.all? do |branch|
85
84
  branch.gcommit.objectish.include?(' -> ') || (
86
- !(branch.full == 'master' || branch.full =~ /^remotes\/.+\/master$/) || branch.gcommit.sha != head_commit_id
85
+ !(branch.full == 'master' || branch.full =~ %r{^remotes/.+/master$}) || branch.gcommit.sha != head_commit_id
87
86
  )
88
87
  end
89
88
  end
@@ -108,25 +107,25 @@ module HybridPlatformsConductor
108
107
  local_environment:
109
108
  )
110
109
  platforms_for(services).each do |platform, platform_services|
111
- if platform.respond_to?(:package)
112
- platform_name = platform.name
113
- # Compute the package ID that is unique to this packaging, so that we don't mix it with others if needed.
114
- package_id = {
115
- platform_name: platform_name,
116
- services: Hash[platform_services.map { |node, node_services| [node, node_services.sort] }].sort,
117
- secrets: secrets.sort,
110
+ next unless platform.respond_to?(:package)
111
+
112
+ platform_name = platform.name
113
+ # Compute the package ID that is unique to this packaging, so that we don't mix it with others if needed.
114
+ package_id = {
115
+ platform_name: platform_name,
116
+ services: platform_services.transform_values(&:sort).sort,
117
+ secrets: secrets.sort,
118
+ local_environment: local_environment
119
+ }
120
+ if ServicesHandler.packaged_deployments.include?(package_id)
121
+ log_debug "Platform #{platform_name} has already been packaged for this deployment (package ID #{package_id}). Won't package it another time."
122
+ else
123
+ platform.package(
124
+ services: platform_services,
125
+ secrets: secrets,
118
126
  local_environment: local_environment
119
- }
120
- if ServicesHandler.packaged_deployments.include?(package_id)
121
- log_debug "Platform #{platform_name} has already been packaged for this deployment (package ID #{package_id}). Won't package it another time."
122
- else
123
- platform.package(
124
- services: platform_services,
125
- secrets: secrets,
126
- local_environment: local_environment
127
- )
128
- ServicesHandler.packaged_deployments << package_id
129
- end
127
+ )
128
+ ServicesHandler.packaged_deployments << package_id
130
129
  end
131
130
  end
132
131
  end
@@ -145,12 +144,14 @@ module HybridPlatformsConductor
145
144
  why_run:
146
145
  )
147
146
  platforms_for(services).each do |platform, platform_services|
147
+ next unless platform.respond_to?(:prepare_for_deploy)
148
+
148
149
  platform.prepare_for_deploy(
149
150
  services: platform_services,
150
151
  secrets: secrets,
151
152
  local_environment: local_environment,
152
153
  why_run: why_run
153
- ) if platform.respond_to?(:prepare_for_deploy)
154
+ )
154
155
  end
155
156
  end
156
157
 
@@ -164,10 +165,11 @@ module HybridPlatformsConductor
164
165
  # * Array< Hash<Symbol,Object> >: List of actions to be done
165
166
  def actions_to_deploy_on(node, services, why_run)
166
167
  services.map do |service|
167
- platform = @platforms_handler.known_platforms.find { |platform| platform.deployable_services.include?(service) }
168
+ platform = @platforms_handler.known_platforms.find { |search_platform| search_platform.deployable_services.include?(service) }
168
169
  raise "No platform is able to deploy the service #{service}" if platform.nil?
170
+
169
171
  # Add some markers in stdout and stderr so that parsing services-oriented deployment output is easier
170
- deploy_marker = "===== [ #{node} / #{service} ] - HPC Service #{why_run ? 'Check' : 'Deploy' } ====="
172
+ deploy_marker = "===== [ #{node} / #{service} ] - HPC Service #{why_run ? 'Check' : 'Deploy'} ====="
171
173
  [{
172
174
  ruby: proc do |stdout, stderr|
173
175
  stdout << "#{deploy_marker} Begin\n"
@@ -210,7 +212,7 @@ module HybridPlatformsConductor
210
212
  end
211
213
 
212
214
  # Regexp: The marker regexp used to separate services deployment
213
- MARKER_REGEXP = /^===== \[ (.+?) \/ (.+?) \] - HPC Service (\w+) ===== Begin$(.+?)^===== \[ \1 \/ \2 \] - HPC Service \3 ===== End$/m
215
+ MARKER_REGEXP = %r{^===== \[ (.+?) / (.+?) \] - HPC Service (\w+) ===== Begin$(.+?)^===== \[ \1 / \2 \] - HPC Service \3 ===== End$}m
214
216
 
215
217
  # Parse stdout and stderr of a given deploy run and get the list of tasks with their status, organized per service and node deployed.
216
218
  #
@@ -234,8 +236,9 @@ module HybridPlatformsConductor
234
236
  log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed node #{stdout_node}, stderr deployed node #{stderr_node}" unless stdout_node == stderr_node
235
237
  log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed service #{stdout_service}, stderr deployed service #{stderr_service}" unless stdout_service == stderr_service
236
238
  log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed mode is #{stdout_mode}, stderr deployed mode is #{stderr_mode}" unless stdout_mode == stderr_mode
237
- platform = @platforms_handler.known_platforms.find { |platform| platform.deployable_services.include?(stdout_service) }
239
+ platform = @platforms_handler.known_platforms.find { |search_platform| search_platform.deployable_services.include?(stdout_service) }
238
240
  raise "No platform is able to deploy the service #{stdout_service}" if platform.nil?
241
+
239
242
  {
240
243
  node: stdout_node,
241
244
  service: stdout_service,
@@ -10,7 +10,7 @@ module HybridPlatformsConductor
10
10
  def self.only_on_nodes
11
11
  # Just 1 node per service and platform
12
12
  Test.nodes_handler.prefetch_metadata_of Test.nodes_handler.known_nodes, :local_node
13
- Test.nodes_handler.known_nodes.select { |node| !Test.nodes_handler.get_local_node_of(node) }
13
+ Test.nodes_handler.known_nodes.reject { |node| Test.nodes_handler.get_local_node_of(node) }
14
14
  end
15
15
 
16
16
  end