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
@@ -3,18 +3,16 @@ describe 'executables\' Actions Executor options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_actions_executor_options
10
- with_test_platform({ nodes: { 'node' => {} } }) do |repository|
11
- yield repository
12
- end
9
+ def with_test_platform_for_actions_executor_options(&block)
10
+ with_test_platform({ nodes: { 'node' => {} } }, &block)
13
11
  end
14
12
 
15
13
  it 'drives the maximum number of threads' do
16
14
  with_test_platform_for_actions_executor_options do
17
- expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
15
+ expect_actions_executor_runs([proc do
18
16
  expect(test_actions_executor.max_threads).to eq 5
19
17
  {}
20
18
  end])
@@ -3,13 +3,11 @@ describe 'executables\' Cmd Runner options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_cmd_runner_options
10
- with_test_platform({ nodes: { 'node' => {} } }) do |repository|
11
- yield repository
12
- end
9
+ def with_test_platform_for_cmd_runner_options(&block)
10
+ with_test_platform({ nodes: { 'node' => {} } }, &block)
13
11
  end
14
12
 
15
13
  it 'displays commands instead of running them' do
@@ -3,19 +3,19 @@ describe 'executables\' common options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_common_options
9
+ def with_test_platform_for_common_options(&block)
10
10
  with_test_platform(
11
11
  {
12
12
  nodes: { 'node1' => { meta: { host_ip: '192.168.42.42' }, services: ['node1_service'] } },
13
13
  deployable_services: %w[node1_service]
14
14
  },
15
- true
16
- ) do |repository|
17
- yield repository
18
- end
15
+ as_git: true,
16
+ additional_config: 'send_logs_to :test_log',
17
+ &block
18
+ )
19
19
  end
20
20
 
21
21
  # List of executables for which we test the common options, along with options to try that should do nothing
@@ -41,14 +41,14 @@ describe 'executables\' common options' do
41
41
  with_test_platform_for_common_options do
42
42
  exit_code, stdout, stderr = run executable, '--help'
43
43
  expect(exit_code).to eq 0
44
- expect(stdout).to match /Usage: .*#{executable}/
44
+ expect(stdout).to match(/Usage: .*#{Regexp.escape(executable)}/)
45
45
  expect(stderr).to eq ''
46
46
  end
47
47
  end
48
48
 
49
49
  it 'accepts the debug mode switch' do
50
50
  with_test_platform_for_common_options do
51
- exit_code, stdout, stderr = run executable, *(['--debug'] + default_options)
51
+ exit_code, _stdout, stderr = run executable, *(['--debug'] + default_options)
52
52
  expect(exit_code).to eq 0
53
53
  # Make sure to ignore the deployment markers from stderr.
54
54
  expect(stderr.gsub("===== [ node1 / node1_service ] - HPC Service Check ===== Begin\n===== [ node1 / node1_service ] - HPC Service Check ===== End\n", '')).to eq ''
@@ -3,246 +3,62 @@ describe 'executables\' Deployer options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_deployer_options
10
- with_test_platform({ nodes: { 'node' => {} } }) do |repository|
11
- yield repository
12
- end
13
- end
14
-
15
- # Mock calls being made to a Thycotic SOAP API using Savon
16
- #
17
- # Parameters::
18
- # * *url* (String): Mocked URL
19
- # * *secret_id* (String): The mocked secret ID
20
- # * *mocked_secrets_file* (String or nil): The mocked secrets file stored in Thycotic, or nil to mock a missing secret
21
- # * *user* (String or nil): The user to be expected, or nil if it should be read from netrc [default: nil]
22
- # * *password* (String or nil): The password to be expected, or nil if it should be read from netrc [default: nil]
23
- def mock_thycotic_file_download_on(url, secret_id, mocked_secrets_file, user: nil, password: nil)
24
- if user.nil?
25
- user = 'thycotic_user_from_netrc'
26
- password = 'thycotic_password_from_netrc'
27
- expect(HybridPlatformsConductor::Credentials).to receive(:with_credentials_for) do |id, _logger, _logger_stderr, url: nil, &client_code|
28
- expect(id).to eq :thycotic
29
- expect(url).to eq url
30
- client_code.call user, password
31
- end
32
- end
33
- # Mock the Savon calls
34
- mocked_savon_client = double 'Mocked Savon client'
35
- expect(Savon).to receive(:client) do |params|
36
- expect(params[:wsdl]).to eq "#{url}/webservices/SSWebservice.asmx?wsdl"
37
- expect(params[:ssl_verify_mode]).to eq :none
38
- mocked_savon_client
39
- end
40
- expect(mocked_savon_client).to receive(:call).with(
41
- :authenticate,
42
- message: {
43
- username: user,
44
- password: password,
45
- domain: 'thycotic_auth_domain'
46
- }
47
- ) do
48
- { authenticate_response: { authenticate_result: { token: 'soap_token' } } }
49
- end
50
- expect(mocked_savon_client).to receive(:call).with(
51
- :get_secret,
52
- message: {
53
- token: 'soap_token',
54
- secretId: secret_id
55
- }
56
- ) do
57
- {
58
- get_secret_response: {
59
- get_secret_result:
60
- if mocked_secrets_file
61
- { secret: { items: { secret_item: { id: '4242' } } } }
62
- else
63
- { errors: { string: 'Access Denied'}, secret_error: { error_code: 'LOAD', error_message: 'Access Denied', allows_response: false } }
64
- end
65
- }
66
- }
67
- end
68
- if mocked_secrets_file
69
- expect(mocked_savon_client).to receive(:call).with(
70
- :download_file_attachment_by_item_id,
71
- message: {
72
- token: 'soap_token',
73
- secretId: secret_id,
74
- secretItemId: '4242'
75
- }
76
- ) do
77
- {
78
- download_file_attachment_by_item_id_response: {
79
- download_file_attachment_by_item_id_result: {
80
- file_attachment: Base64.encode64(mocked_secrets_file)
81
- }
82
- }
83
- }
84
- end
85
- end
86
- ENV['hpc_domain_for_thycotic'] = 'thycotic_auth_domain'
87
- end
88
-
89
- it 'gets secrets from a file' do
90
- with_test_platform_for_deployer_options do |repository|
91
- secrets_file = "#{repository}/my_secrets.json"
92
- File.write(secrets_file, '{ "secret_name": "secret_value" }')
93
- expect(test_deployer).to receive(:deploy_on).with(['node']) do
94
- expect(test_deployer.secrets).to eq [{ 'secret_name' => 'secret_value' }]
95
- {}
96
- end
97
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--secrets', secrets_file
98
- expect(exit_code).to eq 0
99
- expect(stderr).to eq ''
100
- end
101
- end
102
-
103
- it 'gets secrets from several files' do
104
- with_test_platform_for_deployer_options do |repository|
105
- secrets_file1 = "#{repository}/my_secrets1.json"
106
- File.write(secrets_file1, '{ "secret1": "value1" }')
107
- secrets_file2 = "#{repository}/my_secrets2.json"
108
- File.write(secrets_file2, '{ "secret2": "value2" }')
109
- expect(test_deployer).to receive(:deploy_on).with(['node']) do
110
- expect(test_deployer.secrets).to eq [{ 'secret1' => 'value1' }, { 'secret2' => 'value2' }]
111
- {}
112
- end
113
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--secrets', secrets_file1, '--secrets', secrets_file2
114
- expect(exit_code).to eq 0
115
- expect(stderr).to eq ''
116
- end
117
- end
118
-
119
- it 'fails to get secrets from a missing file' do
120
- with_test_platform_for_deployer_options do
121
- expect do
122
- run 'deploy', '--node', 'node', '--secrets', 'unknown_file.json'
123
- end.to raise_error 'Missing secret file: unknown_file.json'
124
- end
125
- end
126
-
127
- it 'gets secrets from a Thycotic Secret Server' do
128
- with_test_platform_for_deployer_options do
129
- expect(test_deployer).to receive(:deploy_on).with(['node']) do
130
- expect(test_deployer.secrets).to eq [{ 'secret_name' => 'secret_value' }]
131
- {}
132
- end
133
- mock_thycotic_file_download_on('https://my_thycotic.domain.com/SecretServer', '1107', '{ "secret_name": "secret_value" }')
134
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--secrets', 'https://my_thycotic.domain.com/SecretServer:1107'
135
- expect(exit_code).to eq 0
136
- expect(stderr).to eq ''
137
- end
138
- end
139
-
140
- it 'gets secrets from a Thycotic Secret Server using env variables' do
141
- with_test_platform_for_deployer_options do
142
- expect(test_deployer).to receive(:deploy_on).with(['node']) do
143
- expect(test_deployer.secrets).to eq [{ 'secret_name' => 'secret_value' }]
144
- {}
145
- end
146
- mock_thycotic_file_download_on(
147
- 'https://my_thycotic.domain.com/SecretServer',
148
- '1107',
149
- '{ "secret_name": "secret_value" }',
150
- user: 'thycotic_user_from_env',
151
- password: 'thycotic_password_from_env'
152
- )
153
- ENV['hpc_user_for_thycotic'] = 'thycotic_user_from_env'
154
- ENV['hpc_password_for_thycotic'] = 'thycotic_password_from_env'
155
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--secrets', 'https://my_thycotic.domain.com/SecretServer:1107'
156
- expect(exit_code).to eq 0
157
- expect(stderr).to eq ''
158
- end
159
- end
160
-
161
- it 'gets secrets from several Thycotic Secret Servers and files' do
162
- with_test_platform_for_deployer_options do |repository|
163
- secrets_file1 = "#{repository}/my_secrets1.json"
164
- File.write(secrets_file1, '{ "secret1": "value1" }')
165
- secrets_file3 = "#{repository}/my_secrets3.json"
166
- File.write(secrets_file3, '{ "secret3": "value3" }')
167
- expect(test_deployer).to receive(:deploy_on).with(['node']) do
168
- expect(test_deployer.secrets).to eq [
169
- { 'secret1' => 'value1' },
170
- { 'secret2' => 'value2' },
171
- { 'secret3' => 'value3' },
172
- { 'secret4' => 'value4' }
173
- ]
174
- {}
175
- end
176
- mock_thycotic_file_download_on('https://my_thycotic2.domain.com/SecretServer', '110702', '{ "secret2": "value2" }')
177
- mock_thycotic_file_download_on('https://my_thycotic4.domain.com/SecretServer', '110704', '{ "secret4": "value4" }')
178
- exit_code, stdout, stderr = run 'deploy', '--node', 'node',
179
- '--secrets', secrets_file1,
180
- '--secrets', 'https://my_thycotic2.domain.com/SecretServer:110702',
181
- '--secrets', secrets_file3,
182
- '--secrets', 'https://my_thycotic4.domain.com/SecretServer:110704'
183
- expect(exit_code).to eq 0
184
- expect(stderr).to eq ''
185
- end
186
- end
187
-
188
- it 'fails to get secrets from a missing Thycotic Secret Server' do
189
- with_test_platform_for_deployer_options do
190
- mock_thycotic_file_download_on('https://my_thycotic.domain.com/SecretServer', '1107', nil)
191
- expect do
192
- run 'deploy', '--node', 'node', '--secrets', 'https://my_thycotic.domain.com/SecretServer:1107'
193
- end.to raise_error 'Unable to fetch secret file ID https://my_thycotic.domain.com/SecretServer:1107'
194
- end
9
+ def with_test_platform_for_deployer_options(&block)
10
+ with_test_platform({ nodes: { 'node' => {} } }, &block)
195
11
  end
196
12
 
197
13
  it 'uses parallel mode' do
198
- with_test_platform_for_deployer_options do |repository|
14
+ with_test_platform_for_deployer_options do
199
15
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
200
16
  expect(test_deployer.concurrent_execution).to eq true
201
17
  {}
202
18
  end
203
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--parallel'
19
+ exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--parallel'
204
20
  expect(exit_code).to eq 0
205
21
  expect(stderr).to eq ''
206
22
  end
207
23
  end
208
24
 
209
25
  it 'uses why-run' do
210
- with_test_platform_for_deployer_options do |repository|
26
+ with_test_platform_for_deployer_options do
211
27
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
212
28
  expect(test_deployer.use_why_run).to eq true
213
29
  {}
214
30
  end
215
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--why-run'
31
+ exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--why-run'
216
32
  expect(exit_code).to eq 0
217
33
  expect(stderr).to eq ''
218
34
  end
219
35
  end
220
36
 
221
37
  it 'uses timeout with why-run' do
222
- with_test_platform_for_deployer_options do |repository|
38
+ with_test_platform_for_deployer_options do
223
39
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
224
40
  expect(test_deployer.timeout).to eq 5
225
41
  {}
226
42
  end
227
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--why-run', '--timeout', '5'
43
+ exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--why-run', '--timeout', '5'
228
44
  expect(exit_code).to eq 0
229
45
  expect(stderr).to eq ''
230
46
  end
231
47
  end
232
48
 
233
49
  it 'fails to use timeout without why-run' do
234
- with_test_platform_for_deployer_options do |repository|
50
+ with_test_platform_for_deployer_options do
235
51
  expect { run 'deploy', '--node', 'node', '--timeout', '5' }.to raise_error(RuntimeError, 'Can\'t have a timeout unless why-run mode. Please don\'t use --timeout without --why-run.')
236
52
  end
237
53
  end
238
54
 
239
55
  it 'uses retries on errors' do
240
- with_test_platform_for_deployer_options do |repository|
56
+ with_test_platform_for_deployer_options do
241
57
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
242
58
  expect(test_deployer.nbr_retries_on_error).to eq 42
243
59
  {}
244
60
  end
245
- exit_code, stdout, stderr = run 'deploy', '--node', 'node', '--retries-on-error', '42'
61
+ exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--retries-on-error', '42'
246
62
  expect(exit_code).to eq 0
247
63
  expect(stderr).to eq ''
248
64
  end
@@ -3,10 +3,10 @@ describe 'executables\' Nodes Handler options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_nodes_handler_options
9
+ def with_test_platform_for_nodes_handler_options(&block)
10
10
  with_test_platforms(
11
11
  {
12
12
  'platform_1' => {
@@ -41,13 +41,13 @@ describe 'executables\' Nodes Handler options' do
41
41
  }
42
42
  }
43
43
  },
44
- nodes_lists: { 'my_list' => ['node11', 'node13'] }
44
+ nodes_lists: { 'my_list' => %w[node11 node13] }
45
45
  },
46
46
  'platform_2' => {
47
47
  nodes: {
48
48
  'node21' => {
49
49
  meta: { host_ip: '192.168.42.21' },
50
- services: ['service2', 'service3']
50
+ services: %w[service2 service3]
51
51
  },
52
52
  'node22' => {
53
53
  meta: { host_ip: '192.168.42.22' },
@@ -55,10 +55,9 @@ describe 'executables\' Nodes Handler options' do
55
55
  }
56
56
  }
57
57
  }
58
- }
59
- ) do |repository|
60
- yield repository
61
- end
58
+ },
59
+ &block
60
+ )
62
61
  end
63
62
 
64
63
  it 'displays info about nodes' do
@@ -69,7 +68,7 @@ describe 'executables\' Nodes Handler options' do
69
68
  ] do
70
69
  exit_code, stdout, stderr = run 'run', '--show-nodes'
71
70
  expect(exit_code).to eq 0
72
- expect(stdout).to eq <<~EOS
71
+ expect(stdout).to eq <<~EO_STDOUT
73
72
  * Known platforms:
74
73
  platform_1 - Type: test - Location: /tmp/hpc_test/platform_1
75
74
  platform_2 - Type: test - Location: /tmp/hpc_test/platform_2
@@ -102,7 +101,7 @@ describe 'executables\' Nodes Handler options' do
102
101
  node21 (192.168.42.21) - service2, service3 -
103
102
  node22 (192.168.42.22) - service1 -
104
103
 
105
- EOS
104
+ EO_STDOUT
106
105
  expect(stderr).to eq ''
107
106
  end
108
107
  end
@@ -3,19 +3,19 @@ describe 'executables\' nodes selection options' do
3
3
  # Setup a platform for tests
4
4
  #
5
5
  # Parameters::
6
- # * Proc: Code called when the platform is setup
6
+ # * *block* (Proc): Code called when the platform is setup
7
7
  # * Parameters::
8
8
  # * *repository* (String): Platform's repository
9
- def with_test_platform_for_nodes_selector_options
9
+ def with_test_platform_for_nodes_selector_options(&block)
10
10
  with_test_platforms(
11
11
  {
12
12
  'platform_1' => {
13
13
  nodes: {
14
14
  'node11' => { services: ['service1'] },
15
- 'node12' => { services: ['service3', 'service1'] },
15
+ 'node12' => { services: %w[service3 service1] },
16
16
  'node13' => { services: ['service2'] }
17
17
  },
18
- nodes_lists: { 'my_list' => ['node11', 'node13'] }
18
+ nodes_lists: { 'my_list' => %w[node11 node13] }
19
19
  },
20
20
  'platform_2' => {
21
21
  nodes: {
@@ -23,10 +23,9 @@ describe 'executables\' nodes selection options' do
23
23
  'node22' => { services: ['service1'] }
24
24
  }
25
25
  }
26
- }
27
- ) do |repository|
28
- yield repository
29
- end
26
+ },
27
+ &block
28
+ )
30
29
  end
31
30
 
32
31
  # Enumerate all command-line selectors to test, and the corresponding nodes list
@@ -59,8 +58,8 @@ describe 'executables\' nodes selection options' do
59
58
 
60
59
  it "resolves '#{args.join(' ')}' into #{expected_nodes.join(', ')}" do
61
60
  with_test_platform_for_nodes_selector_options do
62
- expect(test_deployer).to receive(:deploy_on).with(expected_nodes) { {} }
63
- exit_code, stdout, stderr = run 'deploy', *args
61
+ expect(test_deployer).to receive(:deploy_on).with(expected_nodes).and_return({})
62
+ exit_code, _stdout, stderr = run 'deploy', *args
64
63
  expect(exit_code).to eq 0
65
64
  expect(stderr).to eq ''
66
65
  end