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
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env ruby
2
+ # This scripts creates and destroys containers in an atomic way in a Proxmox cluster.
3
+ # It handles:
4
+ # * An intelligent resources allocation algorithm to balance usage among cluster PVE nodes.
5
+ # * A retry mechanism if the resources are fully reserved.
6
+ # * An expiration mechanism that removes expired containers before assigning new ones to protect resources.
7
+ # It guarantees that:
8
+ # * Any IP and VM ID reserved through this script will not be reserved by another concurrent process (unless the container becomes expired).
9
+ # * If creation is granted, creating this container will not exceed resources limits specified in the config.
10
+ # * The returned reserved VM ID and IP are already created.
11
+
12
+ # Usage: ./reserve_proxmox_container [options]
13
+ # -c, --create FILE Create a VM with the configuration stored in a given JSON file
14
+ # -d, --destroy FILE Destroy a VM with the configuration stored in a given JSON file
15
+ # -h, --help Display help and exit
16
+ # -m, --max-retries NBR Set the maximum number of retries to attempt (default: 240)
17
+ # -o, --config FILE Set the path to the file storing configuration (default: ./config.json)
18
+ # -w, --wait-before-retry SECS Set the number of seconds to wait between retries (default: 4)
19
+
20
+ # Result:
21
+ # There can be some logs but the script ends with a line containing '===== JSON =====' followed by parseable JSON.
22
+ # Resulting JSON has the following structure in case of success:
23
+ # * *pve_node* (String): Name of the pve node on which the creation has been reserved
24
+ # * *vm_id* (Integer): VM ID reserved
25
+ # * *vm_ip* (String): VM IP reserved
26
+ # Resulting JSON has the following structure in case of error:
27
+ # * *error* (String): The error message
28
+
29
+ # Uses:
30
+ # * A config file (given through --config option) that describes the available resources as JSON.
31
+ # Check ProxmoxWaiter#initialize signature for the structure's description of this file.
32
+ # * The environment variables:
33
+ # * *hpc_user_for_proxmox*: User to be used to query Proxmox API
34
+ # * *hpc_password_for_proxmox*: Password to be used to query Proxmox API
35
+ # * *hpc_realm_for_proxmox*: Realm used to connect to the Proxmox API [default = 'pam']
36
+
37
+ require 'json'
38
+
39
+ reserved_resource = nil
40
+
41
+ begin
42
+
43
+ # As this script is meant to be run in an SSH session, make sure we automatically flush stdout/stderr.
44
+ # Otherwise it will wait for the script completion before dumping everything, which is annoying as we want to track when it waits for hours.
45
+ $stdout.sync = true
46
+ $stderr.sync = true
47
+
48
+ require 'optparse'
49
+ require 'time'
50
+ require 'tmpdir'
51
+ require "#{__dir__}/proxmox_waiter"
52
+
53
+ # Define here default values
54
+ create_info = nil
55
+ destroy_info = nil
56
+ wait_time_before_retry_secs = 60
57
+ # Don't hesitate to retry for a few hours, as resources are taken by tests that can run for a few hours sometimes.
58
+ max_retries = 240
59
+ config_file = "#{__dir__}/config.json"
60
+
61
+ OptionParser.new do |opts|
62
+ opts.banner = "Usage: #{$0} [options]"
63
+ opts.on('-c', '--create FILE', 'Create a VM with the configuration stored in a given JSON file') do |file|
64
+ create_info = JSON.parse(File.read(file))
65
+ end
66
+ opts.on('-d', '--destroy FILE', 'Destroy a VM with the configuration stored in a given JSON file') do |file|
67
+ destroy_info = JSON.parse(File.read(file))
68
+ end
69
+ opts.on('-h', '--help', 'Display help and exit') do
70
+ puts opts
71
+ exit 0
72
+ end
73
+ opts.on('-m', '--max-retries NBR', "Set the maximum number of retries to attempt (default: #{max_retries})") do |nbr|
74
+ max_retries = Integer(nbr)
75
+ end
76
+ opts.on('-o', '--config FILE', "Set the path to the file storing configuration (default: #{config_file})") do |file|
77
+ config_file = file
78
+ end
79
+ opts.on('-w', '--wait-before-retry SECS', "Set the number of seconds to wait between retries (default: #{wait_time_before_retry_secs})") do |secs|
80
+ wait_time_before_retry_secs = Integer(secs)
81
+ end
82
+ end.parse!
83
+
84
+ raise 'Either use --create or --destroy options. Not both.' if create_info && destroy_info
85
+
86
+ proxmox_waiter = ProxmoxWaiter.new(
87
+ config_file,
88
+ ENV['hpc_user_for_proxmox'],
89
+ ENV['hpc_password_for_proxmox'],
90
+ ENV['hpc_realm_for_proxmox'] || 'pam'
91
+ )
92
+
93
+ idx_retry = 0
94
+ while idx_retry < max_retries
95
+ reserved_resource =
96
+ if destroy_info.nil?
97
+ puts "[ #{Time.now.utc.strftime('%F %T')} ] - Create #{create_info} in a Proxmox container (attempt ##{idx_retry}/#{max_retries})"
98
+ proxmox_waiter.create(create_info)
99
+ else
100
+ puts "[ #{Time.now.utc.strftime('%F %T')} ] - Destroy #{destroy_info} (attempt ##{idx_retry}/#{max_retries})"
101
+ proxmox_waiter.destroy(destroy_info)
102
+ end
103
+ if reserved_resource.is_a?(Symbol)
104
+ # We got an error (missing resources, IPs...).
105
+ # Try again.
106
+ puts "Could not perform the operation because of error: #{reserved_resource}. Waiting #{wait_time_before_retry_secs} seconds before trying again."
107
+ reserved_resource = { error: reserved_resource }
108
+ sleep wait_time_before_retry_secs
109
+ else
110
+ break
111
+ end
112
+ idx_retry += 1
113
+ end
114
+
115
+ rescue
116
+ reserved_resource = {
117
+ error: "Unhandled exception from reserve_proxmox_container: #{$!}\n#{$!.backtrace.join("\n")}"
118
+ }
119
+ end
120
+
121
+ puts '===== JSON ====='
122
+ puts reserved_resource.to_json
@@ -0,0 +1,69 @@
1
+ require 'erubis'
2
+ require 'hybrid_platforms_conductor/report'
3
+ require 'hybrid_platforms_conductor/confluence'
4
+ require 'hybrid_platforms_conductor/common_config_dsl/confluence'
5
+
6
+ module HybridPlatformsConductor
7
+
8
+ module HpcPlugins
9
+
10
+ module Report
11
+
12
+ # Export in the Mediawiki format
13
+ class Confluence < HybridPlatformsConductor::Report
14
+
15
+ self.extend_config_dsl_with CommonConfigDsl::Confluence, :init_confluence
16
+
17
+ # Give the list of supported locales by this report generator
18
+ # [API] - This method is mandatory.
19
+ #
20
+ # Result::
21
+ # * Array<Symbol>: List of supported locales
22
+ def self.supported_locales
23
+ [:en]
24
+ end
25
+
26
+ # Create a report for a list of nodes, in a given locale
27
+ # [API] - This method is mandatory.
28
+ #
29
+ # Parameters::
30
+ # * *nodes* (Array<String>): List of nodes
31
+ # * *locale_code* (Symbol): The locale code
32
+ def report_for(nodes, locale_code)
33
+ confluence_info = @config.confluence_info
34
+ if confluence_info
35
+ if confluence_info[:inventory_report_page_id]
36
+ @nodes = nodes
37
+ HybridPlatformsConductor::Confluence.with_confluence(confluence_info[:url], @logger, @logger_stderr) do |confluence|
38
+ confluence.update_page(confluence_info[:inventory_report_page_id], render('confluence_inventory'))
39
+ end
40
+ out "Inventory report Confluence page updated. Please visit #{confluence_info[:url]}/pages/viewpage.action?pageId=#{confluence_info[:inventory_report_page_id]}"
41
+ else
42
+ log_warn 'No inventory_report_page_id in the Confluence information defined. Ignoring the Confluence report.'
43
+ end
44
+ else
45
+ log_warn 'No Confluence information defined. Ignoring the Confluence report.'
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ TEMPLATES_PATH = File.expand_path("#{File.dirname(__FILE__)}/templates")
52
+
53
+ # Render a given ERB template into a String
54
+ #
55
+ # Parameters::
56
+ # * *template* (String): Template name
57
+ # Result::
58
+ # * String: Rendered template
59
+ def render(template)
60
+ Erubis::Eruby.new(File.read("#{TEMPLATES_PATH}/#{template}.html.erb")).result(binding)
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,164 @@
1
+ require 'hybrid_platforms_conductor/report'
2
+ require 'time'
3
+
4
+ module HybridPlatformsConductor
5
+
6
+ module HpcPlugins
7
+
8
+ module Report
9
+
10
+ # Export in the Mediawiki format
11
+ class Mediawiki < HybridPlatformsConductor::Report
12
+
13
+ TRANSLATIONS = {
14
+ en: {
15
+ alias: 'Alias',
16
+ comment: 'Comment',
17
+ daily_backup: 'Daily backup',
18
+ direct_deploy: 'Direct deployment',
19
+ encrypted_storage: 'Encrypted storage',
20
+ failover_ips: 'Failover IPs',
21
+ false: 'No',
22
+ fqdn: 'FQDN',
23
+ geom_mirror: 'GEOM mirror',
24
+ gui: 'GUI',
25
+ handled_by_chef: 'Handled by Chef',
26
+ hosted_on: 'Hosted on',
27
+ hostname: 'Hostname',
28
+ image: 'Image',
29
+ kernel: 'Kernel',
30
+ location: 'Location',
31
+ missing_chef_recipes: 'Missing Chef recipes',
32
+ missing_industrialization: 'Missing industrialization',
33
+ non_encrypted_storage: 'Non-encrypted storage',
34
+ openvz_specs: 'OpenVZ specifications',
35
+ os: 'OS',
36
+ xae_ip: 'XAE IP',
37
+ xae_location: 'XAE location',
38
+ xae_physical_ref: 'XAE physical reference',
39
+ xae_reference: 'XAE reference',
40
+ private_ips: 'Private IPs',
41
+ product: 'Product',
42
+ public_ips: 'Public IPs',
43
+ raid: 'RAID setup',
44
+ ripe_ips: 'RIPE IPs',
45
+ server_type: 'Server type',
46
+ 'sub-product': 'Sub-Product',
47
+ true: 'Yes',
48
+ unattended_upgrades: 'Unattended upgrades',
49
+ veid: 'VEID',
50
+ vlan: 'VLAN',
51
+ vrack: 'VRack'
52
+ }
53
+ }
54
+
55
+ # Give the list of supported locales by this report generator
56
+ # [API] - This method is mandatory.
57
+ #
58
+ # Result::
59
+ # * Array<Symbol>: List of supported locales
60
+ def self.supported_locales
61
+ TRANSLATIONS.keys
62
+ end
63
+
64
+ # Create a report for a list of nodes, in a given locale
65
+ # [API] - This method is mandatory.
66
+ #
67
+ # Parameters::
68
+ # * *nodes* (Array<String>): List of nodes
69
+ # * *locale_code* (Symbol): The locale code
70
+ def report_for(nodes, locale_code)
71
+ output = ''
72
+ locale = TRANSLATIONS[locale_code]
73
+
74
+ output << <<~EOS
75
+ Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
76
+
77
+ This page has been generated using <code>./bin/report --format mediawiki</code> on #{Time.now.utc.strftime('%F %T')} UTC.
78
+
79
+ EOS
80
+
81
+ # Get all confs
82
+ # Use the translations' keys to know all properties we want to display
83
+ all_properties = (%i[physical_node cluster private_ips description] + locale.keys).uniq
84
+ @nodes_handler.prefetch_metadata_of nodes, locale.keys
85
+ nodes.
86
+ map do |node|
87
+ { node: node }.merge(Hash[all_properties.map { |property| [property, @nodes_handler.metadata_of(node, property)] }])
88
+ end.
89
+ # Group them by physical / VMs
90
+ group_by do |node_info|
91
+ # Consume the info to not display it again later
92
+ physical_node = node_info.delete(:physical_node)
93
+ !physical_node.nil? && physical_node
94
+ end.
95
+ each do |physical, nodes_for_physical|
96
+ output << "= #{physical ? 'Physical' : 'Virtual'} nodes =\n\n"
97
+ # Group them by location
98
+ nodes_for_physical.
99
+ group_by do |node_info|
100
+ # Consume the info to not display it again later
101
+ cluster = node_info.delete(:cluster)
102
+ cluster.nil? ? '' : cluster
103
+ end.
104
+ sort.
105
+ each do |cluster, nodes_for_cluster|
106
+ output << "== #{cluster.empty? ? 'Independent nodes' : "Belonging to cluster #{cluster}"} ==\n\n"
107
+ # Group them by IP range (24 bits)
108
+ nodes_for_cluster.
109
+ group_by { |node_info| node_info[:private_ips].nil? || node_info[:private_ips].empty? ? [] : node_info[:private_ips].first.split('.')[0..2].map(&:to_i) }.
110
+ sort.
111
+ each do |ip_range, nodes_for_ip_range|
112
+ output << "=== #{ip_range.empty? ? 'No IP' : "#{ip_range.join('.')}/24"} ===\n\n"
113
+ nodes_for_ip_range.
114
+ sort_by { |node_info| node_info[:node] }.
115
+ each do |node_info|
116
+ output << "* '''#{node_info.delete(:node)}'''#{node_info[:private_ips].nil? || node_info[:private_ips].empty? ? '' : " - #{node_info[:private_ips].first}"} - #{node_info.delete(:description)}\n"
117
+ node_info.delete(:private_ips) if !node_info[:private_ips].nil? && node_info[:private_ips].size == 1
118
+ node_info.sort.each do |property, value|
119
+ unless value.nil?
120
+ raise "Missing translation of key: #{property}. Please edit TRANSLATIONS[:#{locale_code}]." unless locale.key?(property)
121
+ formatted_value =
122
+ if value.is_a?(Array)
123
+ "\n#{value.map { |item| "::* #{item}" }.join("\n")}"
124
+ elsif value.is_a?(Hash)
125
+ "\n#{value.map { |item, value| "::* #{item}: #{value}" }.join("\n")}"
126
+ elsif value.is_a?(TrueClass)
127
+ locale[:true]
128
+ elsif value.is_a?(FalseClass)
129
+ locale[:false]
130
+ else
131
+ value.to_str
132
+ end
133
+ output << ": #{locale[property]}: #{formatted_value}\n"
134
+ end
135
+ end
136
+ output << "\n\n"
137
+ end
138
+ end
139
+ end
140
+ end
141
+
142
+ output << <<~EOS
143
+ Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
144
+
145
+ [[Category:My Project]]
146
+ [[Category:Hadoop]]
147
+ [[Category:NoSQL]]
148
+ [[Category:Hosting]]
149
+ [[Category:XAE]]
150
+ [[Category:Server]]
151
+ [[Category:Configuration]]
152
+ [[Category:Chef]]
153
+ EOS
154
+
155
+ out output
156
+ end
157
+
158
+ end
159
+
160
+ end
161
+
162
+ end
163
+
164
+ end
@@ -0,0 +1,88 @@
1
+ # This file is an example of a Reports plugin that can be used to dump information about the platforms.
2
+ # The MyReportPlugin example contains example of code that could be used to write a plugin for a new kind of report.
3
+ require 'hybrid_platforms_conductor/report'
4
+
5
+ module HybridPlatformsConductor
6
+
7
+ module HpcPlugins
8
+
9
+ module Report
10
+
11
+ # Brief description of the plugin here.
12
+ # The name should match the file name.
13
+ # It should always inherit from ReportPlugin.
14
+ # In all instance methods of a platform handler, the following variables are accessible:
15
+ # * @nodes_handler (NodesHandler): Nodes handler used to access information about the platforms
16
+ class MyReportPlugin < HybridPlatformsConductor::Report
17
+
18
+ # Are dependencies met before using this plugin?
19
+ # [API] - This method is optional
20
+ #
21
+ # Result::
22
+ # * Boolean: Are dependencies met before using this plugin?
23
+ def self.valid?
24
+ true
25
+ end
26
+
27
+ # Add a Mixin to the DSL parsing the platforms configuration file.
28
+ # This can be used by any plugin to add plugin-specific configuration getters and setters, accessible later from NodesHandler instances.
29
+ # An optional initializer can also be given.
30
+ # [API] - Those calls are optional
31
+ module MyDSLExtension
32
+
33
+ attr_accessor :my_property
34
+
35
+ # Initialize the DSL
36
+ def init_my_dsl_extension
37
+ @my_property = 42
38
+ end
39
+
40
+ end
41
+ self.extend_config_dsl_with MyDSLExtension, :init_my_dsl_extension
42
+
43
+ # Give the list of supported locales by this report generator
44
+ # [API] - This method is mandatory.
45
+ #
46
+ # Result::
47
+ # * Array<Symbol>: List of supported locales
48
+ def self.supported_locales
49
+ # This method has to publish the list of translations it accepts.
50
+ [
51
+ :fr,
52
+ :en
53
+ ]
54
+ end
55
+
56
+ # Create a report for a list of nodes, in a given locale
57
+ # [API] - This method is mandatory.
58
+ #
59
+ # Parameters::
60
+ # * *nodes* (Array<String>): List of nodes
61
+ # * *locale_code* (Symbol): The locale code
62
+ def report_for(nodes, locale_code)
63
+ # This method simply provides a report for a given list of nodes in the desired locale.
64
+ # The locale will be one of the supported ones.
65
+ output = ''
66
+ case locale_code
67
+ when :fr
68
+ output << 'Un beau rapport'
69
+ when :en
70
+ output << 'A nice report'
71
+ end
72
+ @platforms_handler.known_platforms.each do |platform|
73
+ output << "= Report for platform #{platform.repository_path} of type #{platform.platform_type}:"
74
+ platform.known_nodes.each do |node|
75
+ output << "== Report for node #{node}:"
76
+ output << @nodes_handler.get_description_of node
77
+ end
78
+ end
79
+ out output
80
+ end
81
+
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+
88
+ end
@@ -0,0 +1,61 @@
1
+ require 'hybrid_platforms_conductor/report'
2
+ require 'terminal-table'
3
+
4
+ module HybridPlatformsConductor
5
+
6
+ module HpcPlugins
7
+
8
+ module Report
9
+
10
+ # Export on stdout
11
+ class Stdout < HybridPlatformsConductor::Report
12
+
13
+ # Give the list of supported locales by this report generator
14
+ # [API] - This method is mandatory.
15
+ #
16
+ # Result::
17
+ # * Array<Symbol>: List of supported locales
18
+ def self.supported_locales
19
+ [:en]
20
+ end
21
+
22
+ # Create a report for a list of nodes, in a given locale
23
+ # [API] - This method is mandatory.
24
+ #
25
+ # Parameters::
26
+ # * *nodes* (Array<String>): List of nodes
27
+ # * *locale_code* (Symbol): The locale code
28
+ def report_for(nodes, locale_code)
29
+ @nodes_handler.prefetch_metadata_of nodes, %i[hostname host_ip physical image description services]
30
+ out(Terminal::Table.new(headings: [
31
+ 'Node',
32
+ 'Platform',
33
+ 'Host name',
34
+ 'IP',
35
+ 'Physical?',
36
+ 'OS',
37
+ 'Description',
38
+ 'Services'
39
+ ]) do |table|
40
+ nodes.sort.each do |node|
41
+ table << [
42
+ node,
43
+ @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name,
44
+ @nodes_handler.get_hostname_of(node),
45
+ @nodes_handler.get_host_ip_of(node),
46
+ @nodes_handler.get_physical_of(node) ? 'Yes' : 'No',
47
+ @nodes_handler.get_image_of(node),
48
+ @nodes_handler.get_description_of(node),
49
+ (@nodes_handler.get_services_of(node) || []).sort.join(', ')
50
+ ]
51
+ end
52
+ end)
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end