hybrid_platforms_conductor 32.3.6

Sign up to get free protection for your applications and to get access to all the features.
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,20 @@
1
+ module HybridPlatformsConductor
2
+
3
+ class Topographer
4
+
5
+ # Base class of any topographer plugin
6
+ class Plugin
7
+
8
+ # Constructor
9
+ #
10
+ # Parameters::
11
+ # * *topographer* (Topographer): Topographer instance containing the graph to be output
12
+ def initialize(topographer)
13
+ @topographer = topographer
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,127 @@
1
+ module HybridPlatformsConductor
2
+
3
+ class Topographer
4
+
5
+ module Plugins
6
+
7
+ # Output in Graphviz format
8
+ class Graphviz < Topographer::Plugin
9
+
10
+ # Output the nodes graph in a file
11
+ # [API] - This method is mandatory.
12
+ #
13
+ # Parameters::
14
+ # * *file_name* (String): The file name for output
15
+ def write_graph(file_name)
16
+ # GraphViz format does not support that nodes belong to more than 1 cluster.
17
+ @topographer.force_cluster_strict_hierarchy
18
+ # Write a Graphviz file
19
+ File.open(file_name, 'w') do |f|
20
+ f.puts 'digraph unix {
21
+ size="6,6";
22
+ node [style=filled];'
23
+ # First write the definition of all nodes
24
+ # Find all nodes belonging to no cluster
25
+ orphan_nodes = @topographer.nodes_graph.keys
26
+ @topographer.nodes_graph.each do |node_name, node_info|
27
+ orphan_nodes -= node_info[:includes]
28
+ end
29
+ orphan_nodes.sort.each do |node_name|
30
+ write_node_def_gv(f, node_name)
31
+ end
32
+ # Then write all connections
33
+ @topographer.nodes_graph.sort.each do |node_name, node_info|
34
+ node_info[:connections].each do |connected_node_name, labels|
35
+ link_label = labels.sort.join(', ')
36
+ link_label = "#{link_label[0..@topographer.config[:max_link_label_length] - 1]}..." if link_label.size > @topographer.config[:max_link_label_length]
37
+ link_options = {
38
+ label: link_label
39
+ }
40
+ f.puts " \"#{dot_name_for_link(node_name)}\" -> \"#{dot_name_for_link(connected_node_name)}\" [ #{link_options.map { |opt, val| "#{opt}=\"#{val}\"" }.join(' ') } ];"
41
+ end
42
+ end
43
+ f.puts '}'
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ # Write a node defintion in a GraphViz file
50
+ #
51
+ # Parameters::
52
+ # * *file* (IO): File to write to
53
+ # * *node_name* (String): Node to write
54
+ def write_node_def_gv(file, node_name)
55
+ description = @topographer.description_for(node_name)
56
+ dot_name = dot_name_for(node_name)
57
+ node_options = {
58
+ label: "#{@topographer.title_for(node_name)}#{description.nil? ? '' : "\\n#{description}"}",
59
+ color: color_for(node_name)
60
+ }
61
+ if @topographer.is_node_cluster?(node_name)
62
+ # A cluster node
63
+ file.puts " subgraph \"#{dot_name}\" {\n#{node_options.map { |opt, val| " #{opt}=\"#{val}\";\n" }.join}"
64
+ # Always define an anchor node per cluster, as it will serve for links to and from the cluster itself.
65
+ anchor_node_options = {
66
+ label: "#{@topographer.title_for(node_name)}#{description.nil? ? '' : "\\n#{description}"}",
67
+ color: 'green'
68
+ }
69
+ file.puts " \"#{dot_name_for_link(node_name)}\" [ #{anchor_node_options.map { |opt, val| "#{opt}=\"#{val}\"" }.join(' ') } ];"
70
+ @topographer.nodes_graph[node_name][:includes].sort.each do |included_node_name|
71
+ write_node_def_gv(file, included_node_name)
72
+ end
73
+ file.puts ' }'
74
+ else
75
+ # A normal node
76
+ file.puts " \"#{dot_name}\" [ #{node_options.map { |opt, val| "#{opt}=\"#{val}\"" }.join(' ') } ];"
77
+ end
78
+ end
79
+
80
+ # Get the node color of a given node
81
+ #
82
+ # Parameters::
83
+ # * *node_name* (String): Node name
84
+ # Result::
85
+ # * String: Color code
86
+ def color_for(node_name)
87
+ case @topographer.nodes_graph[node_name][:type]
88
+ when :node
89
+ if @topographer.is_node_physical?(node_name)
90
+ 'lightpink'
91
+ else
92
+ 'lightblue2'
93
+ end
94
+ when :cluster
95
+ 'black'
96
+ when :unknown
97
+ 'red'
98
+ end
99
+ end
100
+
101
+ # Get the DOT node name a given node
102
+ #
103
+ # Parameters::
104
+ # * *node_name* (String): Node name
105
+ # Result::
106
+ # * String: DOT node name
107
+ def dot_name_for(node_name)
108
+ @topographer.is_node_cluster?(node_name) ? "cluster_#{node_name}" : node_name
109
+ end
110
+
111
+ # Get the DOT node name used in a link for a given node
112
+ #
113
+ # Parameters::
114
+ # * *node_name* (String): Node name
115
+ # Result::
116
+ # * String: DOT node name used for links
117
+ def dot_name_for_link(node_name)
118
+ @topographer.is_node_cluster?(node_name) ? "cluster_#{node_name}_anchor" : node_name
119
+ end
120
+
121
+ end
122
+
123
+ end
124
+
125
+ end
126
+
127
+ end
@@ -0,0 +1,72 @@
1
+ require 'json'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ class Topographer
6
+
7
+ module Plugins
8
+
9
+ # Output in Graphviz format
10
+ class Json < Topographer::Plugin
11
+
12
+ # Output the nodes graph in a file
13
+ # [API] - This method is mandatory.
14
+ #
15
+ # Parameters::
16
+ # * *file_name* (String): The file name for output
17
+ def write_graph(file_name)
18
+ # Build the JSON
19
+ json = {
20
+ nodes: [],
21
+ links: [],
22
+ }
23
+ @topographer.nodes_graph.sort.each do |node_name, node_info|
24
+ node_json = {
25
+ id: node_name,
26
+ description: "#{@topographer.title_for(node_name)} - #{@topographer.description_for(node_name)}",
27
+ group: group_for(node_name),
28
+ }
29
+ node_json[:includes] = node_info[:includes] if @topographer.is_node_cluster?(node_name)
30
+ json[:nodes] << node_json
31
+ node_info[:connections].each do |connected_node_name, labels|
32
+ json[:links] << {
33
+ source: node_name,
34
+ target: connected_node_name,
35
+ value: 1,
36
+ labels: labels.sort
37
+ }
38
+ end
39
+ end
40
+ File.write(file_name, JSON.pretty_generate(json))
41
+ end
42
+
43
+ private
44
+
45
+ # Get the group of a given node
46
+ #
47
+ # Parameters::
48
+ # * *node_name* (String): Node name
49
+ # Result::
50
+ # * String: Group
51
+ def group_for(node_name)
52
+ case @topographer.nodes_graph[node_name][:type]
53
+ when :node
54
+ if @topographer.is_node_physical?(node_name)
55
+ 1
56
+ else
57
+ 2
58
+ end
59
+ when :cluster
60
+ 3
61
+ when :unknown
62
+ 4
63
+ end
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+
72
+ end
@@ -0,0 +1,37 @@
1
+ # This file is an example of a generic Test plugin.
2
+ # The MyTopographerOutputPlugin example contains example of code that could be used to write a plugin for new topographer output formats.
3
+ module HybridPlatformsConductor
4
+
5
+ class Topographer
6
+
7
+ module Plugins
8
+
9
+ # Brief description of the plugin here.
10
+ # The name should match the file name.
11
+ # It should always inherit from Topographer::Plugin.
12
+ # In all instance methods of a test plugin, the following variables are accessible:
13
+ # * @topographer (Topographer): Topographer used to get info about the graph to render.
14
+ class MyTopographerOutputPlugin < Topographer::Plugin
15
+
16
+ # Output the nodes graph in a file
17
+ # [API] - This method is mandatory.
18
+ #
19
+ # Parameters::
20
+ # * *file_name* (String): The file name for output
21
+ def write_graph(file_name)
22
+ # This method is meant to dump into a file named file_name the graph in the plugin-specific format.
23
+ File.open(file_name, 'w') do |f|
24
+ f.puts 'Graph dump'
25
+ @topographer.nodes_graph.each do |node_name, node_info|
26
+ f.puts "#{node_name} is linked to #{node_info[:connections].map { |connected_node_name, _labels| connected_node_name }.join(', ')}"
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,30 @@
1
+ require "#{File.dirname(__FILE__)}/graphviz"
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ class Topographer
6
+
7
+ module Plugins
8
+
9
+ # Output in Graphviz format
10
+ class Svg < Topographer::Plugins::Graphviz
11
+
12
+ # Output the nodes graph in a file
13
+ # [API] - This method is mandatory.
14
+ #
15
+ # Parameters::
16
+ # * *file_name* (String): The file name for output
17
+ def write_graph(file_name)
18
+ gv_file_name = "#{file_name}.gv"
19
+ super(gv_file_name)
20
+ system "dot -Tsvg #{gv_file_name} -o #{file_name}"
21
+ File.unlink gv_file_name
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,5 @@
1
+ module HybridPlatformsConductor
2
+
3
+ VERSION = '32.3.6'
4
+
5
+ end
@@ -0,0 +1,159 @@
1
+ require 'fileutils'
2
+ require 'tmpdir'
3
+ require 'hybrid_platforms_conductor/config'
4
+ require 'hybrid_platforms_conductor/platforms_handler'
5
+ require 'hybrid_platforms_conductor/actions_executor'
6
+ require 'hybrid_platforms_conductor/cmd_runner'
7
+ require 'hybrid_platforms_conductor/deployer'
8
+ require 'hybrid_platforms_conductor/nodes_handler'
9
+ require 'hybrid_platforms_conductor/platform_handler'
10
+ require 'hybrid_platforms_conductor/provisioner'
11
+ require 'hybrid_platforms_conductor/report'
12
+ require 'hybrid_platforms_conductor/reports_handler'
13
+ require 'hybrid_platforms_conductor/test'
14
+ require 'hybrid_platforms_conductor/test_report'
15
+ require 'hybrid_platforms_conductor/tests_runner'
16
+ require 'hybrid_platforms_conductor/hpc_plugins/cmdb/config'
17
+ require 'hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip'
18
+ require 'hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys'
19
+ require 'hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers'
20
+ require 'hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb'
21
+ require 'hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2'
22
+ require 'hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others'
23
+ require 'hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2'
24
+ require 'hybrid_platforms_conductor_test/helpers/actions_executor_helpers'
25
+ require 'hybrid_platforms_conductor_test/helpers/cmd_runner_helpers'
26
+ require 'hybrid_platforms_conductor_test/helpers/cmdb_helpers'
27
+ require 'hybrid_platforms_conductor_test/helpers/config_helpers'
28
+ require 'hybrid_platforms_conductor_test/helpers/connector_ssh_helpers'
29
+ require 'hybrid_platforms_conductor_test/helpers/deployer_helpers'
30
+ require 'hybrid_platforms_conductor_test/helpers/deployer_test_helpers'
31
+ require 'hybrid_platforms_conductor_test/helpers/executables_helpers'
32
+ require 'hybrid_platforms_conductor_test/helpers/nodes_handler_helpers'
33
+ require 'hybrid_platforms_conductor_test/helpers/platform_handler_helpers'
34
+ require 'hybrid_platforms_conductor_test/helpers/platforms_handler_helpers'
35
+ require 'hybrid_platforms_conductor_test/helpers/plugins_helpers'
36
+ require 'hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers'
37
+ require 'hybrid_platforms_conductor_test/helpers/reports_handler_helpers'
38
+ require 'hybrid_platforms_conductor_test/helpers/services_handler_helpers'
39
+ require 'hybrid_platforms_conductor_test/helpers/tests_runner_helpers'
40
+ require 'hybrid_platforms_conductor_test/platform_handler_plugins/test'
41
+ require 'hybrid_platforms_conductor_test/platform_handler_plugins/test2'
42
+ require 'hybrid_platforms_conductor_test/report_plugin'
43
+ require 'hybrid_platforms_conductor_test/test_action'
44
+ require 'hybrid_platforms_conductor_test/test_connector'
45
+ require 'hybrid_platforms_conductor_test/test_plugins/global'
46
+ require 'hybrid_platforms_conductor_test/test_plugins/node'
47
+ require 'hybrid_platforms_conductor_test/test_plugins/node_check'
48
+ require 'hybrid_platforms_conductor_test/test_plugins/node_ssh'
49
+ require 'hybrid_platforms_conductor_test/test_plugins/platform'
50
+ require 'hybrid_platforms_conductor_test/test_plugins/several_checks'
51
+ require 'hybrid_platforms_conductor_test/test_provisioner'
52
+ require 'hybrid_platforms_conductor_test/tests_report_plugin'
53
+
54
+ module HybridPlatformsConductorTest
55
+
56
+ # Helpers for the tests
57
+ module Helpers
58
+
59
+ include ActionsExecutorHelpers
60
+ include CmdbHelpers
61
+ include CmdRunnerHelpers
62
+ include ConfigHelpers
63
+ include ConnectorSshHelpers
64
+ include DeployerHelpers
65
+ include ExecutablesHelpers
66
+ include NodesHandlerHelpers
67
+ include PlatformHandlerHelpers
68
+ include PlatformsHandlerHelpers
69
+ include PluginsHelpers
70
+ include ProvisionerProxmoxHelpers
71
+ include ReportsHandlerHelpers
72
+ include ServicesHandlerHelpers
73
+ include TestsRunnerHelpers
74
+
75
+ # Make sure the tested components are being reset before each test case
76
+ RSpec.configure do |config|
77
+ config.before(:each) do
78
+ @actions_executor = nil
79
+ @cmd_runner = nil
80
+ @config = nil
81
+ @deployer = nil
82
+ @nodes_handler = nil
83
+ @platforms_handler = nil
84
+ @reports_handler = nil
85
+ @services_handler = nil
86
+ @tests_runner = nil
87
+ ENV.delete 'hpc_platforms'
88
+ ENV.delete 'hpc_ssh_gateways_conf'
89
+ ENV.delete 'hpc_ssh_gateway_user'
90
+ ENV.delete 'hpc_user_for_proxmox'
91
+ ENV.delete 'hpc_password_for_proxmox'
92
+ ENV.delete 'hpc_realm_for_proxmox'
93
+ ENV.delete 'hpc_user_for_thycotic'
94
+ ENV.delete 'hpc_password_for_thycotic'
95
+ ENV.delete 'hpc_domain_for_thycotic'
96
+ ENV.delete 'hpc_certificates'
97
+ # Set the necessary Hybrid Platforms Conductor environment variables
98
+ ENV['hpc_ssh_user'] = 'test_user'
99
+ HybridPlatformsConductor::ServicesHandler.packaged_deployments.clear
100
+ HybridPlatformsConductorTest::TestAction.reset
101
+ HybridPlatformsConductorTest::PlatformHandlerPlugins::Test.reset
102
+ HybridPlatformsConductorTest::PlatformHandlerPlugins::Test2.reset
103
+ HybridPlatformsConductorTest::TestsReportPlugin.reports = []
104
+ HybridPlatformsConductorTest::ReportPlugin.generated_reports = []
105
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = []
106
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = nil
107
+ HybridPlatformsConductorTest::TestProvisioner.mocked_default_timeout = 1
108
+ HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs = 0
109
+ HybridPlatformsConductorTest::TestPlugins::Global.fail = false
110
+ HybridPlatformsConductorTest::TestPlugins::Platform.runs = []
111
+ HybridPlatformsConductorTest::TestPlugins::Platform.fail_for = []
112
+ HybridPlatformsConductorTest::TestPlugins::Platform.only_on_platform_types = nil
113
+ HybridPlatformsConductorTest::TestPlugins::Platform.sleeps = {}
114
+ HybridPlatformsConductorTest::TestPlugins::Node.runs = []
115
+ HybridPlatformsConductorTest::TestPlugins::Node.fail_for = {}
116
+ HybridPlatformsConductorTest::TestPlugins::Node.only_on_platform_types = nil
117
+ HybridPlatformsConductorTest::TestPlugins::Node.only_on_nodes = nil
118
+ HybridPlatformsConductorTest::TestPlugins::Node.sleeps = {}
119
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = {}
120
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.only_on_platform_types = nil
121
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.only_on_nodes = nil
122
+ HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs = []
123
+ HybridPlatformsConductorTest::TestPlugins::NodeCheck.fail_for = []
124
+ HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_platform_types = nil
125
+ HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_nodes = nil
126
+ HybridPlatformsConductorTest::TestPlugins::SeveralChecks.runs = []
127
+ FileUtils.rm_rf './run_logs'
128
+ FileUtils.rm_rf './testadmin.key.pub'
129
+ FileUtils.rm_rf '/tmp/hpc_ssh'
130
+ # Make sure CMDB plugin classes loaded by test framework are not added automatically
131
+ register_plugins(:cmdb, {
132
+ config: HybridPlatformsConductor::HpcPlugins::Cmdb::Config,
133
+ host_ip: HybridPlatformsConductor::HpcPlugins::Cmdb::HostIp,
134
+ host_keys: HybridPlatformsConductor::HpcPlugins::Cmdb::HostKeys,
135
+ platform_handlers: HybridPlatformsConductor::HpcPlugins::Cmdb::PlatformHandlers
136
+ })
137
+ end
138
+ end
139
+
140
+ private
141
+
142
+ # Get the logger for tests
143
+ #
144
+ # Result::
145
+ # * Logger: The logger to be used
146
+ def logger
147
+ if ENV['TEST_DEBUG'] == '1'
148
+ logger = Logger.new(STDOUT)
149
+ logger.level = Logger::DEBUG
150
+ logger
151
+ else
152
+ # Still put the level, as when testing executables we switch the device from /dev/null to a file
153
+ Logger.new('/dev/null', level: :info)
154
+ end
155
+ end
156
+
157
+ end
158
+
159
+ end