hybrid_platforms_conductor 32.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. checksums.yaml +7 -0
  2. data/bin/check-node +24 -0
  3. data/bin/deploy +12 -0
  4. data/bin/dump_nodes_json +12 -0
  5. data/bin/free_ips +23 -0
  6. data/bin/free_veids +17 -0
  7. data/bin/get_impacted_nodes +43 -0
  8. data/bin/last_deploys +56 -0
  9. data/bin/nodes_to_deploy +104 -0
  10. data/bin/report +10 -0
  11. data/bin/run +39 -0
  12. data/bin/setup +11 -0
  13. data/bin/ssh_config +14 -0
  14. data/bin/test +13 -0
  15. data/bin/topograph +54 -0
  16. data/lib/hybrid_platforms_conductor/action.rb +82 -0
  17. data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
  18. data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
  19. data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
  20. data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
  21. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
  22. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
  23. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
  24. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
  25. data/lib/hybrid_platforms_conductor/config.rb +263 -0
  26. data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
  27. data/lib/hybrid_platforms_conductor/connector.rb +84 -0
  28. data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
  29. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
  30. data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
  31. data/lib/hybrid_platforms_conductor/executable.rb +145 -0
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
  74. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
  75. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
  76. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
  77. data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
  78. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
  79. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
  80. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
  81. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
  82. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
  83. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
  84. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
  85. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
  86. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
  87. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
  88. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
  89. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
  90. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
  91. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
  92. data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
  93. data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
  94. data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
  95. data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
  96. data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
  97. data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
  98. data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
  99. data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
  100. data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
  101. data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
  102. data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
  103. data/lib/hybrid_platforms_conductor/report.rb +31 -0
  104. data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
  105. data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
  106. data/lib/hybrid_platforms_conductor/test.rb +141 -0
  107. data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
  108. data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
  109. data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
  110. data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
  111. data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
  112. data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
  113. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
  114. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
  115. data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
  116. data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
  117. data/lib/hybrid_platforms_conductor/version.rb +5 -0
  118. data/spec/hybrid_platforms_conductor_test.rb +159 -0
  119. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
  120. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
  121. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
  122. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
  123. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
  124. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
  125. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
  126. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
  127. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
  128. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
  129. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
  130. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
  131. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
  132. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
  133. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
  134. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
  135. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
  136. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
  137. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
  142. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
  143. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
  144. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
  145. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
  146. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
  147. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
  148. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
  149. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
  150. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
  151. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
  152. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
  153. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
  154. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
  155. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
  156. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
  157. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
  158. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
  159. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
  160. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
  161. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
  162. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
  163. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
  164. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
  165. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
  166. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
  167. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
  168. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
  169. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
  170. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
  171. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
  172. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
  173. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
  174. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
  175. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
  176. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
  177. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
  178. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
  179. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
  180. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
  181. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
  182. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
  183. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
  184. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
  185. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
  186. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
  187. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
  188. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
  189. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
  190. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
  191. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
  192. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
  193. data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
  194. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
  195. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
  196. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
  197. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
  198. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
  199. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
  200. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
  201. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
  202. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
  203. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
  204. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
  205. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
  206. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
  207. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
  208. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
  209. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
  210. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
  211. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
  212. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
  213. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
  214. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
  215. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
  216. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
  217. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
  218. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
  219. data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
  220. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
  221. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
  222. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
  223. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
  224. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
  225. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
  226. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
  227. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
  228. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
  229. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
  230. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
  231. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
  232. data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
  233. data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
  234. data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
  236. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
  237. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
  238. data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
  239. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
  240. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
  241. data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
  242. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
  243. data/spec/spec_helper.rb +111 -0
  244. metadata +566 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e16a6630a51ed9208fa4a3cecfce6604c65a39cb782d9efa426898ec980d5071
4
+ data.tar.gz: 33f38588a1b795e323f76e909ef301905cacf9d77c0a418ac0809713960659b6
5
+ SHA512:
6
+ metadata.gz: 16a3b130741673e1ce4bfee15a5a4d8c45c66e5712e130a746f2d6be1e9940a1052a2c9195cce748831ca1652cc52255002226b31c0494516250b5359074c592
7
+ data.tar.gz: 920f8a21967bc69ecaf6072eec422e119e989415ddcd26d9e42e2d38779a35ddcfe58f5819cd3165c12799cf297dc5530da9a8d80ea6ae8c6a81c662d62c8fda
data/bin/check-node ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ test_node = nil
5
+ executable = HybridPlatformsConductor::Executable.new(
6
+ check_options: false,
7
+ nodes_selection_options: false,
8
+ parallel_options: false
9
+ ) do |opts|
10
+ opts.on('-n', '--node NODE', 'Run the command on a specific node.') do |node|
11
+ test_node = node
12
+ end
13
+ end
14
+ nodes_handler = executable.nodes_handler
15
+ actions_executor = executable.actions_executor
16
+ deployer = executable.deployer
17
+
18
+ executable.parse_options!
19
+ raise 'No node selected. Please use --node option to set at least one.' if test_node.nil? || test_node.empty?
20
+ raise "Unknown node: #{test_node}" unless nodes_handler.known_nodes.include?(test_node)
21
+
22
+ # Make sure we always use why-run
23
+ deployer.use_why_run = true
24
+ deployer.deploy_on(test_node)
data/bin/deploy ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new
5
+ actions_executor = executable.actions_executor
6
+ deployer = executable.deployer
7
+
8
+ executable.parse_options!
9
+ raise 'No node selected. Please use --node option to set at least one.' if executable.selected_nodes.empty?
10
+
11
+ # Deploy all
12
+ deployer.deploy_on(executable.selected_nodes)
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new(parallel_options: false)
5
+ deployer = executable.deployer
6
+ json_dumper = executable.json_dumper
7
+ deployer.timeout = 30
8
+ deployer.use_why_run = true
9
+
10
+ executable.parse_options!
11
+
12
+ json_dumper.dump_json_for(executable.selected_nodes)
data/bin/free_ips ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require 'range_operators'
3
+ require 'hybrid_platforms_conductor/executable'
4
+
5
+ executable = HybridPlatformsConductor::Executable.new(nodes_selection_options: false)
6
+
7
+ nodes_handler = executable.nodes_handler
8
+
9
+ executable.parse_options!
10
+
11
+ # Group IPs per first 3 numbers
12
+ nodes_handler.prefetch_metadata_of nodes_handler.known_nodes, :private_ips
13
+ nodes_handler.
14
+ known_nodes.
15
+ map { |node| nodes_handler.get_private_ips_of(node) || [] }.
16
+ flatten.
17
+ uniq.
18
+ group_by { |ip| ip.split('.')[0..2].map(&:to_i) }.
19
+ sort.
20
+ map { |ip_root, ips| [ip_root, ips.map { |ip| ip.split('.').last.to_i }] }.
21
+ each do |ip_root, ip_fourths|
22
+ executable.out "Free IPs for #{ip_root.join('.')}: #{([256] + ip_fourths).missing.rangify}"
23
+ end
data/bin/free_veids ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require 'range_operators'
3
+ require 'hybrid_platforms_conductor/executable'
4
+
5
+ executable = HybridPlatformsConductor::Executable.new(nodes_selection_options: false)
6
+
7
+ nodes_handler = executable.nodes_handler
8
+
9
+ executable.parse_options!
10
+
11
+ nodes_handler.prefetch_metadata_of nodes_handler.known_nodes, :veid
12
+ veids = nodes_handler.
13
+ known_nodes.
14
+ map { |node| nodes_handler.get_veid_of(node) ? nodes_handler.get_veid_of(node).to_i : nil }.
15
+ compact
16
+
17
+ executable.out "Free VEIDs: #{([10_000] + veids).missing.rangify}"
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ git_from = 'master'
5
+ git_to = nil
6
+ smallest_set = false
7
+ platform = nil
8
+ platforms_handler = nil
9
+ executable = HybridPlatformsConductor::Executable.new(nodes_selection_options: false) do |opts|
10
+ opts.on('-f', '--from-commit COMMIT_ID', "Specify the GIT commit from which we look for diffs. Defaults to #{git_from}.") do |commit_id|
11
+ git_from = commit_id
12
+ end
13
+ opts.on('-p', '--platform PLATFORM_NAME', "Specify the repository on which to perform the diff. Possible values are #{platforms_handler.known_platforms.join(', ')}") do |platform_name|
14
+ platform = platform_name
15
+ end
16
+ opts.on('-s', '--smallest-test-sample', 'Display the minimal set of nodes to check that would validate all modifications.') do
17
+ smallest_set = true
18
+ end
19
+ opts.on('-t', '--to-commit COMMIT_ID', 'Specify the GIT commit to which we look for diffs. Defaults to current checked out files.') do |commit_id|
20
+ git_to = commit_id
21
+ end
22
+ end
23
+ nodes_handler = executable.nodes_handler
24
+ platforms_handler = executable.platforms_handler
25
+ cmd_runner = executable.cmd_runner
26
+ executable.parse_options!
27
+ raise 'No platform specified. Please use --platform option' if platform.nil?
28
+
29
+ all_impacted_nodes, impacted_nodes, impacted_services, impact_global = nodes_handler.impacted_nodes_from_git_diff(
30
+ platform,
31
+ from_commit: git_from,
32
+ to_commit: git_to,
33
+ smallest_set: smallest_set
34
+ )
35
+
36
+ executable.out '* Potentially all nodes of this platform are impacted.' if impact_global
37
+ executable.out ''
38
+ executable.out "* #{impacted_services.size} impacted services:\n#{impacted_services.join("\n")}"
39
+ executable.out ''
40
+ executable.out "* #{impacted_nodes.size} impacted nodes (directly):\n#{impacted_nodes.join("\n")}"
41
+ executable.out ''
42
+ executable.out "* #{all_impacted_nodes.size} impacted nodes (total#{smallest_set ? ' smallest set' : ''}):\n#{all_impacted_nodes.join("\n")}"
43
+ executable.out ''
data/bin/last_deploys ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ require 'time'
3
+ require 'terminal-table'
4
+ require 'hybrid_platforms_conductor/executable'
5
+
6
+ possible_string_sorts = %i[
7
+ date
8
+ node
9
+ user
10
+ ]
11
+ possible_sorts = Hash[possible_string_sorts.map do |property_name|
12
+ [
13
+ property_name,
14
+ proc { |node, deploy_info| [deploy_info.key?(:error) || !deploy_info.key?(property_name) ? '' : deploy_info[property_name], node] }
15
+ ]
16
+ end]
17
+
18
+ sort_by = :node
19
+ sort_desc = false
20
+ executable = HybridPlatformsConductor::Executable.new(deploy_options: false) do |opts|
21
+ opts.on('-r', '--sort-by SORT', "Specify a sort. Possible values are: #{possible_sorts.keys.sort.join(', ')}. Each value can append _desc to specify a reverse sorting. Defaults to #{sort_by}.") do |sort_name|
22
+ if sort_name =~ /^(.+)_desc$/
23
+ sort_desc = true
24
+ sort_name = $1
25
+ end
26
+ sort_by = sort_name.to_sym
27
+ end
28
+ end
29
+ nodes_handler = executable.nodes_handler
30
+ deployer = executable.deployer
31
+
32
+ executable.parse_options!
33
+ raise "Unknown sort name: #{sort_by}. Should be one of #{possible_sorts.keys.join(', ')}." unless possible_sorts.key?(sort_by)
34
+
35
+ sorted_deploy_info = Hash[
36
+ deployer.deployment_info_from(nodes_handler.select_nodes(executable.selected_nodes.empty? ? [{ all: true }] : executable.selected_nodes)).
37
+ map do |node, deploy_info|
38
+ decorated_deploy_info = deploy_info.merge(node: node)
39
+ decorated_deploy_info[:date] = deploy_info[:date].strftime('%F %T') if deploy_info.key?(:date)
40
+ decorated_deploy_info[:services] = deploy_info[:services].join(', ') if deploy_info.key?(:services)
41
+ [node, decorated_deploy_info]
42
+ end
43
+ ].sort_by(&possible_sorts[sort_by])
44
+ sorted_deploy_info.reverse! if sort_desc
45
+ info_displayed = {
46
+ node: 'Node',
47
+ date: 'Date',
48
+ user: 'Admin',
49
+ services: 'Services',
50
+ error: 'Error'
51
+ }
52
+ executable.out(Terminal::Table.new(headings: info_displayed.values) do |table|
53
+ sorted_deploy_info.each do |_node, deploy_info|
54
+ table << info_displayed.keys.map { |key| deploy_info[key] }
55
+ end
56
+ end)
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env ruby
2
+ require 'time'
3
+ require 'hybrid_platforms_conductor/executable'
4
+
5
+ ignore_schedule = false
6
+ ignore_deploy_info = false
7
+ deploy_time = Time.now.utc
8
+ executable = HybridPlatformsConductor::Executable.new(deploy_options: false) do |opts|
9
+ opts.on('--deployment-time DATETIME', 'Set the deployment time to be considered while matching the schedules. Defaults to now.') do |date_time_str|
10
+ deploy_time = Time.parse("#{date_time_str} UTC")
11
+ end
12
+ opts.on('--ignore-deployed-info', 'Ignore the current deployed information.') do
13
+ ignore_deploy_info = true
14
+ end
15
+ opts.on('--ignore-schedule', 'Ignore the deployment schedules.') do
16
+ ignore_schedule = true
17
+ end
18
+ end
19
+ nodes_handler = executable.nodes_handler
20
+ deployer = executable.deployer
21
+
22
+ executable.parse_options!
23
+
24
+ nodes = (nodes_handler.select_nodes(executable.selected_nodes.empty? ? [{ all: true }] : executable.selected_nodes))
25
+
26
+ unless ignore_schedule
27
+ # Select nodes to be deployed, based first on deployment schedule
28
+ executable.log_debug "Consider deployment time for schedule: #{deploy_time.strftime('%F %T')}."
29
+ nodes.select! do |node|
30
+ # Select nodes whose schedule for deployment includes the deployment time
31
+ deployment_schedules = nodes_handler.select_confs_for_node(node, executable.config.deployment_schedules)
32
+ if deployment_schedules.empty?
33
+ # Consider we always deploy this node
34
+ executable.log_warn "[ #{node} ] - No deployment schedule defined."
35
+ true
36
+ else
37
+ executable.log_debug "[ #{node} ] - Deployment schedules: #{JSON.pretty_generate(deployment_schedules.map { |deployment_schedule_info| deployment_schedule_info[:schedule].to_h })}"
38
+ if deployment_schedules.any? { |deployment_schedule_info| deployment_schedule_info[:schedule].occurring_at?(deploy_time) }
39
+ executable.log_debug "[ #{node} ] - Node selected from the deployment schedule."
40
+ true
41
+ else
42
+ executable.log_debug "[ #{node} ] - Node NOT selected from the deployment schedule."
43
+ false
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ unless ignore_deploy_info
50
+ # Select nodes that have a git diff impact with master
51
+ # Get their current deployment info
52
+ deploy_info = deployer.deployment_info_from(nodes)
53
+ # Cache the impacted nodes, as very often the git diff can be lengthy and the same diff will be reused by several nodes
54
+ # Hash< String, Hash< String, Array< String > > >
55
+ # Hash< repo_name, Hash< commit_id, Array< node > > >
56
+ cache_impacted_nodes = {}
57
+ nodes.select! do |node|
58
+ node_deploy_info = deploy_info[node]
59
+ executable.log_debug "[ #{node} ] - Deployment info: #{JSON.pretty_generate(node_deploy_info)}"
60
+ if node_deploy_info.key?(:error)
61
+ executable.log_warn "[ #{node} ] - Deployment in error: #{node_deploy_info[:error]}"
62
+ true
63
+ elsif !node_deploy_info.key?(:exit_status) || node_deploy_info[:exit_status] != '0'
64
+ executable.log_warn "[ #{node} ] - Last deployment did not end successfully: #{node_deploy_info[:exit_status]}"
65
+ true
66
+ elsif node_deploy_info.key?(:repo_name_0)
67
+ node_impacted = false
68
+ # Loop over all possible repositories concerned by this deployment
69
+ repo_idx = 0
70
+ while node_deploy_info.key?("repo_name_#{repo_idx}".to_sym) do
71
+ repo_name = node_deploy_info["repo_name_#{repo_idx}".to_sym]
72
+ commit_id = node_deploy_info["commit_id_#{repo_idx}".to_sym]
73
+ impacted_nodes = cache_impacted_nodes.dig(repo_name, commit_id)
74
+ if impacted_nodes.nil?
75
+ impacted_nodes, _single_impacted_nodes, _impacted_services, _impact_global = nodes_handler.impacted_nodes_from_git_diff(
76
+ repo_name,
77
+ from_commit: commit_id,
78
+ to_commit: 'master'
79
+ )
80
+ cache_impacted_nodes[repo_name] = {} unless cache_impacted_nodes.key?(repo_name)
81
+ cache_impacted_nodes[repo_name][commit_id] = impacted_nodes
82
+ end
83
+ if impacted_nodes.include?(node)
84
+ executable.log_debug "[ #{node} ] - Diffs on #{repo_name} between #{commit_id} and master are impacting this node."
85
+ node_impacted = true
86
+ break
87
+ else
88
+ executable.log_debug "[ #{node} ] - No impacting diffs on #{repo_name} between #{commit_id} and master for this node."
89
+ end
90
+ repo_idx += 1
91
+ end
92
+ node_impacted
93
+ else
94
+ # The deployment log has no repo name info.
95
+ # Consider it always has to be deployed.
96
+ true
97
+ end
98
+ end
99
+ end
100
+
101
+ executable.out '===== Nodes to deploy ====='
102
+ nodes.sort.each do |node|
103
+ executable.out node
104
+ end
data/bin/report ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new
5
+ reports_handler = executable.reports_handler
6
+
7
+ executable.parse_options!
8
+
9
+ selected_nodes = executable.selected_nodes
10
+ reports_handler.produce_report_for(selected_nodes.empty? ? [{ all: true }] : selected_nodes)
data/bin/run ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ commands = []
5
+ timeout = nil
6
+ concurrent_execution = false
7
+ interactive = false
8
+ executable = HybridPlatformsConductor::Executable.new do |opts|
9
+ opts.on('-c', '--command CMD', 'Command to execute (can\'t be used with --interactive) (can be used several times, commands will be executed sequentially)') do |cmd|
10
+ commands << cmd
11
+ end
12
+ opts.on('-f', '--commands-file FILE_NAME', 'Execute commands taken from a file (can\'t be used with --interactive) (can be used several times, commands will be executed sequentially)') do |file_name|
13
+ commands << { file: file_name }
14
+ end
15
+ opts.on('-i', '--interactive', 'Run an interactive SSH session instead of executing a command (can\'t be used with --command or --commands-file)') do
16
+ interactive = true
17
+ end
18
+ opts.on('-p', '--parallel', 'Execute the commands in parallel (put the standard output in files <hybrid-platforms-dir>/run_logs/*.stdout)') do
19
+ concurrent_execution = true
20
+ end
21
+ opts.on('-t', '--timeout SECS', 'Timeout in seconds to wait for each command (defaults to no timeout)') do |nbr_secs|
22
+ timeout = nbr_secs.to_i
23
+ end
24
+ end
25
+ actions_executor = executable.actions_executor
26
+
27
+ executable.parse_options!
28
+ raise '--interactive or --command options have to be present' if commands.empty? && !interactive
29
+ raise 'No node selected. Please use --node option to set at least one.' if executable.selected_nodes.empty?
30
+
31
+ actions = []
32
+ actions << { remote_bash: commands } unless commands.empty?
33
+ actions << { interactive: true } if interactive
34
+ actions_executor.execute_actions(
35
+ { executable.selected_nodes => actions },
36
+ timeout: timeout,
37
+ concurrent: concurrent_execution,
38
+ log_to_stdout: executable.log_debug? || !concurrent_execution
39
+ )
data/bin/setup ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new(nodes_selection_options: false)
5
+ platforms_handler = executable.platforms_handler
6
+
7
+ executable.parse_options!
8
+
9
+ platforms_handler.known_platforms.each do |platform|
10
+ platform.setup
11
+ end
data/bin/ssh_config ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ ssh_exec = 'ssh'
5
+ executable = HybridPlatformsConductor::Executable.new(nodes_selection_options: false, parallel_options: false) do |opts|
6
+ opts.on('-x', '--ssh-exec FILE_PATH', "Path to the SSH executable to be used. Useful to give default options (especially with GIT_SSH). Defaults to #{ssh_exec}.") do |file_path|
7
+ ssh_exec = file_path
8
+ end
9
+ end
10
+ actions_executor = executable.actions_executor
11
+
12
+ executable.parse_options!
13
+
14
+ executable.out actions_executor.connector(:ssh).ssh_config(ssh_exec: ssh_exec)
data/bin/test ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new(
5
+ check_options: false,
6
+ parallel_options: false,
7
+ timeout_options: false
8
+ )
9
+ tests_runner = executable.tests_runner
10
+
11
+ executable.parse_options!
12
+
13
+ exit(tests_runner.run_tests(executable.selected_nodes))
data/bin/topograph ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ require 'hybrid_platforms_conductor/executable'
3
+
4
+ executable = HybridPlatformsConductor::Executable.new(
5
+ check_options: false,
6
+ nodes_selection_options: false,
7
+ parallel_options: false
8
+ )
9
+ nodes_handler = executable.nodes_handler
10
+ deployer = executable.deployer
11
+ deployer.timeout = 30
12
+ deployer.concurrent_execution = true
13
+ deployer.use_why_run = true
14
+ topographer = executable.topographer
15
+
16
+ executable.parse_options!
17
+
18
+ # Initialize the topograph
19
+ from_nodes, to_nodes = topographer.resolve_from_to
20
+ topographer.get_json_files
21
+
22
+ # The list of clusters to group nodes into 1 graphviz node to simplify the graph.
23
+ known_nodes_lists = nodes_handler.known_nodes_lists
24
+
25
+ executable.section 'Compute graph' do
26
+ topographer.graph_for(nodes_handler.known_nodes)
27
+ end
28
+ executable.section 'Add nodes lists clusters' do
29
+ topographer.graph_for_nodes_lists(known_nodes_lists)
30
+ end
31
+ executable.section 'Define IP 24 clusters' do
32
+ topographer.define_clusters_ip_24
33
+ end
34
+ nodes = nil
35
+ executable.section 'Select path' do
36
+ from_nodes = topographer.children_nodes(from_nodes)
37
+ to_nodes = topographer.ancestor_nodes(to_nodes)
38
+ nodes = from_nodes & to_nodes
39
+ end
40
+ executable.section "Filter only nodes #{nodes.sort.join(', ')}" do
41
+ topographer.filter_in_nodes(nodes + topographer.cluster_nodes)
42
+ end
43
+ executable.section 'Collapse nodes lists' do
44
+ topographer.collapse_nodes(known_nodes_lists)
45
+ end
46
+ executable.section 'Remove self references' do
47
+ topographer.remove_self_connections
48
+ end
49
+ executable.section 'Remove empty clusters' do
50
+ topographer.remove_empty_clusters
51
+ end
52
+ executable.section 'Write outputs' do
53
+ topographer.dump_outputs
54
+ end