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,145 @@
1
+ require 'optparse'
2
+ require 'logger'
3
+ require 'hybrid_platforms_conductor/config'
4
+ require 'hybrid_platforms_conductor/platforms_handler'
5
+ require 'hybrid_platforms_conductor/nodes_handler'
6
+ require 'hybrid_platforms_conductor/actions_executor'
7
+ require 'hybrid_platforms_conductor/cmd_runner'
8
+ require 'hybrid_platforms_conductor/deployer'
9
+ require 'hybrid_platforms_conductor/json_dumper'
10
+ require 'hybrid_platforms_conductor/reports_handler'
11
+ require 'hybrid_platforms_conductor/tests_runner'
12
+ require 'hybrid_platforms_conductor/topographer'
13
+ require 'hybrid_platforms_conductor/logger_helpers'
14
+ require 'hybrid_platforms_conductor/current_dir_monitor'
15
+
16
+ module HybridPlatformsConductor
17
+
18
+ # Give a common executable interface to all our executables
19
+ class Executable
20
+
21
+ include LoggerHelpers
22
+
23
+ # Give the list of selected nodes, if the option was offered. Check NodesHandler#select_nodes to know which kind of nodes description exist.
24
+ # Array<Object>
25
+ attr_reader :selected_nodes
26
+
27
+ # Constructor
28
+ #
29
+ # Parameters::
30
+ # * *check_options* (Boolean): Do we offer check/why-run options? [default: true]
31
+ # * *nodes_selection_options* (Boolean): Do we offer nodes selection options? [default: true]
32
+ # * *parallel_options* (Boolean): Do we offer parallel options? [default: true]
33
+ # * *timeout_options* (Boolean): Do we offer timeout options? [default: true]
34
+ # * *deploy_options* (Boolean): Do we offer deploy options? [default: true]
35
+ # * *logger* (Logger): The stdout logger to be used [default: Logger.new(STDOUT, level: :info)]
36
+ # * *logger_stderr* (Logger): The stderr logger to be used [default: Logger.new(STDERR, level: :info)]
37
+ # * *opts_block* (Proc): Optional code called to register main options
38
+ # * Parameters::
39
+ # * *opts* (OptionsParser): The options parser to complete
40
+ def initialize(
41
+ check_options: true,
42
+ nodes_selection_options: true,
43
+ parallel_options: true,
44
+ timeout_options: true,
45
+ deploy_options: true,
46
+ logger: Logger.new(STDOUT, level: :info),
47
+ logger_stderr: Logger.new(STDERR, level: :info),
48
+ &opts_block
49
+ )
50
+ init_loggers(logger, logger_stderr)
51
+ @check_options = check_options
52
+ @nodes_selection_options = nodes_selection_options
53
+ @parallel_options = parallel_options
54
+ @timeout_options = timeout_options
55
+ @deploy_options = deploy_options
56
+ @opts_block = opts_block
57
+ # List of nodes description selected
58
+ @selected_nodes = []
59
+ # Possible Conductor components this executable can use
60
+ @instantiated_components = {}
61
+ # Initialize the loggers
62
+ # We set the debug format right now before calling the options parser, just in case some option parsing needs debugging (like plugins discovery)
63
+ self.log_level = :debug if ARGV.include?('--debug') || ARGV.include?('-d')
64
+ end
65
+
66
+ # Define all the dependency injection rules between the various APIs.
67
+ # Singleton accessors for each one of those components will be generated automatically based on these definitions.
68
+ {
69
+ config: [],
70
+ cmd_runner: [],
71
+ platforms_handler: %i[config cmd_runner],
72
+ nodes_handler: %i[config cmd_runner platforms_handler],
73
+ actions_executor: %i[config cmd_runner nodes_handler],
74
+ services_handler: %i[config cmd_runner platforms_handler nodes_handler actions_executor],
75
+ deployer: %i[config cmd_runner nodes_handler actions_executor services_handler],
76
+ json_dumper: %i[config nodes_handler deployer],
77
+ reports_handler: %i[config platforms_handler nodes_handler],
78
+ tests_runner: %i[config cmd_runner platforms_handler nodes_handler actions_executor deployer],
79
+ topographer: %i[nodes_handler json_dumper]
80
+ }.each do |component, dependencies|
81
+
82
+ # Has a singleton been instantiated for this component?
83
+ #
84
+ # Result::
85
+ # * Boolean: Has a singleton been instantiated for this component?
86
+ define_method("#{component}_instantiated?".to_sym) do
87
+ @instantiated_components.key?(component)
88
+ end
89
+
90
+ # Get a singleton for this component
91
+ #
92
+ # Result::
93
+ # * Object: The corresponding component
94
+ define_method(component) do
95
+ @instantiated_components[component] = HybridPlatformsConductor.const_get(component.to_s.split('_').collect(&:capitalize).join.to_sym).new(
96
+ logger: @logger,
97
+ logger_stderr: @logger_stderr,
98
+ **Hash[dependencies.map { |dependency| [dependency, send(dependency)] }]
99
+ ) unless @instantiated_components.key?(component)
100
+ @instantiated_components[component]
101
+ end
102
+
103
+ end
104
+
105
+ # Parse options for this executable.
106
+ # Use options for any Hybrid Platforms Conductor component that has been accessed through the above methods.
107
+ # Handle common options (like logging and help).
108
+ def parse_options!
109
+ OptionParser.new do |opts|
110
+ opts.banner = "Usage: #{$0} [options]"
111
+ opts.separator ''
112
+ opts.separator 'Main options:'
113
+ opts.on('-d', '--debug', 'Activate debug mode') do
114
+ self.log_level = :debug
115
+ end
116
+ opts.on('-h', '--help', 'Display help and exit') do
117
+ out opts
118
+ exit 0
119
+ end
120
+ @opts_block.call(opts) if @opts_block
121
+ nodes_handler.options_parse(opts) if nodes_handler_instantiated?
122
+ nodes_handler.options_parse_nodes_selectors(opts, @selected_nodes) if @nodes_selection_options
123
+ cmd_runner.options_parse(opts) if cmd_runner_instantiated?
124
+ actions_executor.options_parse(opts, parallel: @parallel_options) if actions_executor_instantiated?
125
+ deployer.options_parse(
126
+ opts,
127
+ parallel_switch: @parallel_options,
128
+ timeout_options: @timeout_options,
129
+ why_run_switch: @check_options
130
+ ) if deployer_instantiated? && @deploy_options
131
+ json_dumper.options_parse(opts) if json_dumper_instantiated?
132
+ reports_handler.options_parse(opts) if reports_handler_instantiated?
133
+ tests_runner.options_parse(opts) if tests_runner_instantiated?
134
+ topographer.options_parse(opts) if topographer_instantiated?
135
+ end.parse!
136
+ actions_executor.validate_params if actions_executor_instantiated?
137
+ deployer.validate_params if deployer_instantiated?
138
+ reports_handler.validate_params if reports_handler_instantiated?
139
+ topographer.validate_params if topographer_instantiated?
140
+ raise "Unknown options: #{ARGV.join(' ')}" unless ARGV.empty?
141
+ end
142
+
143
+ end
144
+
145
+ end
@@ -0,0 +1,44 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Action
6
+
7
+ # Execute Bash commands locally
8
+ class Bash < HybridPlatformsConductor::Action
9
+
10
+ # Setup the action.
11
+ # This is called by the constructor itself, when an action is instantiated to be executed for a node.
12
+ # [API] - This method is optional
13
+ # [API] - @cmd_runner is accessible
14
+ # [API] - @actions_executor is accessible
15
+ #
16
+ # Parameters::
17
+ # * *cmd* (String): The bash command to execute
18
+ def setup(cmd)
19
+ @cmd = cmd
20
+ end
21
+
22
+ # Execute the action
23
+ # [API] - This method is mandatory
24
+ # [API] - @cmd_runner is accessible
25
+ # [API] - @actions_executor is accessible
26
+ # [API] - @action_info is accessible with the action details
27
+ # [API] - @node (String) can be used to know on which node the action is to be executed
28
+ # [API] - @connector (Connector or nil) can be used to access the node's connector if the action needs remote connection
29
+ # [API] - @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds
30
+ # [API] - @stdout_io can be used to log stdout messages
31
+ # [API] - @stderr_io can be used to log stderr messages
32
+ # [API] - run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result's signature.
33
+ def execute
34
+ log_debug "[#{@node}] - Execute local Bash commands \"#{@cmd}\"..."
35
+ run_cmd @cmd
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,44 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Action
6
+
7
+ # Execute an interactive session on the remote node
8
+ class Interactive < HybridPlatformsConductor::Action
9
+
10
+ # Do we need a connector to execute this action on a node?
11
+ #
12
+ # Result::
13
+ # * Boolean: Do we need a connector to execute this action on a node?
14
+ def need_connector?
15
+ true
16
+ end
17
+
18
+ # Execute the action
19
+ # [API] - This method is mandatory
20
+ # [API] - @cmd_runner is accessible
21
+ # [API] - @actions_executor is accessible
22
+ # [API] - @action_info is accessible with the action details
23
+ # [API] - @node (String) can be used to know on which node the action is to be executed
24
+ # [API] - @connector (Connector or nil) can be used to access the node's connector if the action needs remote connection
25
+ # [API] - @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds
26
+ # [API] - @stdout_io can be used to log stdout messages
27
+ # [API] - @stderr_io can be used to log stderr messages
28
+ # [API] - run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result's signature.
29
+ def execute
30
+ log_debug "[#{@node}] - Run interactive remote session..."
31
+ if @cmd_runner.dry_run
32
+ log_debug "[#{@node}] - Won't execute interactive shell in dry_run mode."
33
+ else
34
+ @connector.remote_interactive
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,79 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Action
6
+
7
+ # Example of an action plugin
8
+ class MyAction < HybridPlatformsConductor::Action
9
+
10
+ # Are dependencies met before using this plugin?
11
+ # [API] - This method is optional
12
+ #
13
+ # Result::
14
+ # * Boolean: Are dependencies met before using this plugin?
15
+ def self.valid?
16
+ true
17
+ end
18
+
19
+ # Add a Mixin to the DSL parsing the platforms configuration file.
20
+ # This can be used by any plugin to add plugin-specific configuration getters and setters, accessible later from NodesHandler instances.
21
+ # An optional initializer can also be given.
22
+ # [API] - Those calls are optional
23
+ module MyDSLExtension
24
+
25
+ attr_accessor :my_property
26
+
27
+ # Initialize the DSL
28
+ def init_my_dsl_extension
29
+ @my_property = 42
30
+ end
31
+
32
+ end
33
+ self.extend_config_dsl_with MyDSLExtension, :init_my_dsl_extension
34
+
35
+ # Setup the action.
36
+ # This is called by the constructor itself, when an action is instantiated to be executed for a node.
37
+ # [API] - This method is optional
38
+ # [API] - @cmd_runner is accessible
39
+ # [API] - @actions_executor is accessible
40
+ #
41
+ # Parameters::
42
+ # * *action_info* (Object): The action info
43
+ def setup(action_info)
44
+ @action_info[:message] = 'Default message' unless @action_info.key?(:message)
45
+ end
46
+
47
+ # Do we need a connector to execute this action on a node?
48
+ # [API] - This method is optional
49
+ # [API] - @cmd_runner is accessible
50
+ # [API] - @actions_executor is accessible
51
+ #
52
+ # Result::
53
+ # * Boolean: Do we need a connector to execute this action on a node?
54
+ def need_connector?
55
+ true
56
+ end
57
+
58
+ # Execute the action
59
+ # [API] - This method is mandatory
60
+ # [API] - @cmd_runner is accessible
61
+ # [API] - @actions_executor is accessible
62
+ # [API] - @action_info is accessible with the action details
63
+ # [API] - @node (String) can be used to know on which node the action is to be executed
64
+ # [API] - @connector (Connector or nil) can be used to access the node's connector if the action needs remote connection
65
+ # [API] - @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds
66
+ # [API] - @stdout_io can be used to log stdout messages
67
+ # [API] - @stderr_io can be used to log stderr messages
68
+ # [API] - run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result's signature.
69
+ def execute
70
+ run_cmd "echo #{@action_info[:message]} on #{@node}"
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+
79
+ end
@@ -0,0 +1,63 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Action
6
+
7
+ # Execute a bash command on the remote node
8
+ class RemoteBash < HybridPlatformsConductor::Action
9
+
10
+ # Setup the action.
11
+ # This is called by the constructor itself, when an action is instantiated to be executed for a node.
12
+ # [API] - This method is optional
13
+ # [API] - @cmd_runner is accessible
14
+ # [API] - @actions_executor is accessible
15
+ #
16
+ # Parameters::
17
+ # * *remote_bash* (Array< Hash<Symbol, Object> or Array<String> or String>): List of bash actions to execute. Each action can have the following properties:
18
+ # * *commands* (Array<String> or String): List of bash commands to execute (can be a single one). This is the default property also that allows to not use the Hash form for brevity.
19
+ # * *file* (String): Name of file from which commands should be taken.
20
+ # * *env* (Hash<String, String>): Environment variables to be set before executing those commands.
21
+ def setup(remote_bash)
22
+ @remote_bash = remote_bash
23
+ # Normalize the parameters
24
+ @remote_bash = [@remote_bash] if @remote_bash.is_a?(String)
25
+ @remote_bash = { commands: @remote_bash } if @remote_bash.is_a?(Array)
26
+ @remote_bash[:commands] = [@remote_bash[:commands]] if @remote_bash[:commands].is_a?(String)
27
+ end
28
+
29
+ # Do we need a connector to execute this action on a node?
30
+ #
31
+ # Result::
32
+ # * Boolean: Do we need a connector to execute this action on a node?
33
+ def need_connector?
34
+ true
35
+ end
36
+
37
+ # Execute the action
38
+ # [API] - This method is mandatory
39
+ # [API] - @cmd_runner is accessible
40
+ # [API] - @actions_executor is accessible
41
+ # [API] - @action_info is accessible with the action details
42
+ # [API] - @node (String) can be used to know on which node the action is to be executed
43
+ # [API] - @connector (Connector or nil) can be used to access the node's connector if the action needs remote connection
44
+ # [API] - @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds
45
+ # [API] - @stdout_io can be used to log stdout messages
46
+ # [API] - @stderr_io can be used to log stderr messages
47
+ # [API] - run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result's signature.
48
+ def execute
49
+ bash_commands = (@remote_bash[:env] || {}).map { |var_name, var_value| "export #{var_name}='#{var_value}'" }
50
+ bash_commands.concat(@remote_bash[:commands].clone) if @remote_bash.key?(:commands)
51
+ bash_commands << File.read(@remote_bash[:file]) if @remote_bash.key?(:file)
52
+ bash_str = bash_commands.join("\n")
53
+ log_debug "[#{@node}] - Execute remote Bash commands \"#{bash_str}\"..."
54
+ @connector.remote_bash bash_str
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,69 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Action
6
+
7
+ # Execute Ruby commands locally
8
+ class Ruby < HybridPlatformsConductor::Action
9
+
10
+ # Setup the action.
11
+ # This is called by the constructor itself, when an action is instantiated to be executed for a node.
12
+ # [API] - This method is optional
13
+ # [API] - @cmd_runner is accessible
14
+ # [API] - @actions_executor is accessible
15
+ #
16
+ # Parameters::
17
+ # * *info* (Hash<Symbol, Object>): Properties for the Ruby action:
18
+ # * *code* (Proc): Ruby code to be executed.
19
+ # This is the default property, and can be given directly without using a Hash.
20
+ # * Parameters::
21
+ # * *stdout* (IO): Stream in which stdout of this action should be written.
22
+ # * *stderr* (IO): Stream in which stderr of this action should be written.
23
+ # * *action* (Action): Action we can use to access other context-specific methods, such as run_cmd.
24
+ # * *connector* (Connector or nil): The connector to the node, or nil if none.
25
+ # * *need_remote* (Boolean): Do we need a remote connection to the node for this code to run? [default = false]
26
+ def setup(info)
27
+ info = { code: info } if info.is_a?(Proc)
28
+ @need_remote = info[:need_remote] || false
29
+ @code = info[:code]
30
+ end
31
+
32
+ # Do we need a connector to execute this action on a node?
33
+ #
34
+ # Result::
35
+ # * Boolean: Do we need a connector to execute this action on a node?
36
+ def need_connector?
37
+ @need_remote
38
+ end
39
+
40
+ # Execute the action
41
+ # [API] - This method is mandatory
42
+ # [API] - @cmd_runner is accessible
43
+ # [API] - @actions_executor is accessible
44
+ # [API] - @action_info is accessible with the action details
45
+ # [API] - @node (String) can be used to know on which node the action is to be executed
46
+ # [API] - @connector (Connector or nil) can be used to access the node's connector if the action needs remote connection
47
+ # [API] - @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds
48
+ # [API] - @stdout_io can be used to log stdout messages
49
+ # [API] - @stderr_io can be used to log stderr messages
50
+ # [API] - run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result's signature.
51
+ def execute
52
+ log_debug "[#{@node}] - Execute local Ruby code #{@code}..."
53
+ # TODO: Handle timeout without using Timeout which is harmful when dealing with SSH connections and multithread.
54
+ @code.call @stdout_io, @stderr_io, self, @connector
55
+ end
56
+
57
+ # Make the run_cmd method public for this action as it can be used by client procs
58
+ public :run_cmd
59
+
60
+ # Give access to the node so that action can use it
61
+ attr_reader :node
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end