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.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
|
+
|
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
4
|
+
|
|
5
|
+
context 'checking the reserve_proxmox_container sync tool' do
|
|
6
|
+
|
|
7
|
+
context 'checking retries mechanism' do
|
|
8
|
+
|
|
9
|
+
it 'retries a few times before ending in error' do
|
|
10
|
+
with_sync_node do
|
|
11
|
+
mock_proxmox(mocked_pve_nodes: [{ 'pve_node_name' => {} }] * 5)
|
|
12
|
+
expect(call_reserve_proxmox_container(2, 128 * 1024, 4, max_retries: 5)).to eq(error: 'not_enough_resources')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'retries errors a few times until it gets resolved' do
|
|
17
|
+
with_sync_node do
|
|
18
|
+
mock_proxmox(mocked_pve_nodes: [
|
|
19
|
+
{ 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
|
|
20
|
+
{ 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
|
|
21
|
+
{ 'pve_node_name' => { loadavg: [0.1, 9, 0.1] } }
|
|
22
|
+
])
|
|
23
|
+
expect(call_reserve_proxmox_container(2, 1024, 4, max_retries: 5)).to eq(
|
|
24
|
+
pve_node: 'pve_node_name',
|
|
25
|
+
vm_id: 1000,
|
|
26
|
+
vm_ip: '192.168.0.100'
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
|
+
|
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
4
|
+
|
|
5
|
+
context 'checking the reserve_proxmox_container sync tool' do
|
|
6
|
+
|
|
7
|
+
context 'checking how VM IDs are being assigned to containers' do
|
|
8
|
+
|
|
9
|
+
it 'makes sure to not use a VM ID already assigned to another container' do
|
|
10
|
+
with_sync_node do
|
|
11
|
+
mock_proxmox(mocked_pve_nodes: {
|
|
12
|
+
'pve_node_name' => {
|
|
13
|
+
lxc_containers: {
|
|
14
|
+
1000 => { ip: '192.168.1.100' },
|
|
15
|
+
1001 => { ip: '192.168.1.101' }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
|
|
20
|
+
pve_node: 'pve_node_name',
|
|
21
|
+
vm_id: 1002,
|
|
22
|
+
vm_ip: '192.168.0.100'
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'makes sure to not use a VM ID already assigned to another container even on another PVE node' do
|
|
28
|
+
with_sync_node do
|
|
29
|
+
mock_proxmox(mocked_pve_nodes: {
|
|
30
|
+
'pve_node_name' => {},
|
|
31
|
+
'pve_other_node_name' => {
|
|
32
|
+
lxc_containers: {
|
|
33
|
+
1000 => { ip: '192.168.1.100' },
|
|
34
|
+
1001 => { ip: '192.168.1.101' }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
|
|
39
|
+
pve_node: 'pve_node_name',
|
|
40
|
+
vm_id: 1002,
|
|
41
|
+
vm_ip: '192.168.0.100'
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'does not reserve when no VM ID is available' do
|
|
47
|
+
with_sync_node do
|
|
48
|
+
mock_proxmox(mocked_pve_nodes: {
|
|
49
|
+
'pve_node_name' => {},
|
|
50
|
+
'pve_other_node_name' => {
|
|
51
|
+
lxc_containers: {
|
|
52
|
+
1000 => { ip: '192.168.1.100' },
|
|
53
|
+
1001 => { ip: '192.168.1.101' },
|
|
54
|
+
1002 => { ip: '192.168.1.102' },
|
|
55
|
+
1003 => { ip: '192.168.1.103' }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1002] })).to eq(error: 'no_available_vm_id')
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
|
+
|
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
4
|
+
|
|
5
|
+
context 'checking containers start' do
|
|
6
|
+
|
|
7
|
+
it 'starts an instance' do
|
|
8
|
+
with_test_proxmox_platform do |instance|
|
|
9
|
+
mock_proxmox_calls_with [
|
|
10
|
+
# 1 - The info on existing containers
|
|
11
|
+
mock_proxmox_to_get_nodes_info,
|
|
12
|
+
# 2 - The start of the container
|
|
13
|
+
mock_proxmox_to_start_node
|
|
14
|
+
]
|
|
15
|
+
instance.create
|
|
16
|
+
instance.start
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'fails to start an instance when the Proxmox task ends in error' do
|
|
21
|
+
with_test_proxmox_platform do |instance|
|
|
22
|
+
mock_proxmox_calls_with [
|
|
23
|
+
# 1 - The info on existing containers
|
|
24
|
+
mock_proxmox_to_get_nodes_info,
|
|
25
|
+
# 2 - The start of the container
|
|
26
|
+
mock_proxmox_to_start_node(task_status: 'ERROR')
|
|
27
|
+
]
|
|
28
|
+
instance.create
|
|
29
|
+
expect { instance.start }.to raise_error '[ node/test ] - Proxmox task UPID:pve_node_name:0000A504:6DEABF24:5F44669B:start::root@pam: completed with status ERROR'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'retries calls to the API when getting back errors 5xx' do
|
|
34
|
+
with_test_proxmox_platform do |instance|
|
|
35
|
+
mock_proxmox_calls_with [
|
|
36
|
+
# 1 - The info on existing containers
|
|
37
|
+
mock_proxmox_to_get_nodes_info,
|
|
38
|
+
# 2 - The start of the container - fail a few times
|
|
39
|
+
mock_proxmox_to_start_node(nbr_api_errors: 3)
|
|
40
|
+
]
|
|
41
|
+
instance.create
|
|
42
|
+
# To speed up the test, alter the wait time between retries.
|
|
43
|
+
old_wait_secs = HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_get(:RETRY_WAIT_TIME_SECS)
|
|
44
|
+
begin
|
|
45
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
|
46
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, 1)
|
|
47
|
+
instance.start
|
|
48
|
+
ensure
|
|
49
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
|
50
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, old_wait_secs)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'fails to create an instance when the Proxmox API fails too many times' do
|
|
56
|
+
with_test_proxmox_platform do |instance|
|
|
57
|
+
mock_proxmox_calls_with [
|
|
58
|
+
# 1 - The info on existing containers
|
|
59
|
+
mock_proxmox_to_get_nodes_info,
|
|
60
|
+
# 2 - The start of the container - fail too many times
|
|
61
|
+
mock_proxmox_to_start_node(nbr_api_errors: HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_get(:NBR_RETRIES_MAX), task_status: nil)
|
|
62
|
+
]
|
|
63
|
+
instance.create
|
|
64
|
+
# To speed up the test, alter the wait time between retries.
|
|
65
|
+
old_wait_secs = HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_get(:RETRY_WAIT_TIME_SECS)
|
|
66
|
+
begin
|
|
67
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
|
68
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, 1)
|
|
69
|
+
expect { instance.start }.to raise_error '[ node/test ] - Proxmox API call post nodes/pve_node_name/lxc/1024/status/start [] is constantly failing. Giving up.'
|
|
70
|
+
ensure
|
|
71
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.send(:remove_const, :RETRY_WAIT_TIME_SECS)
|
|
72
|
+
HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox.const_set(:RETRY_WAIT_TIME_SECS, old_wait_secs)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
|
+
|
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
4
|
+
|
|
5
|
+
context 'checking containers state' do
|
|
6
|
+
|
|
7
|
+
it 'gets the status of a missing instance' do
|
|
8
|
+
with_test_proxmox_platform do |instance|
|
|
9
|
+
expect(instance.state).to eq :missing
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'gets the status of a created instance' do
|
|
14
|
+
with_test_proxmox_platform do |instance|
|
|
15
|
+
mock_proxmox_calls_with [
|
|
16
|
+
# 1 - The info on existing containers
|
|
17
|
+
mock_proxmox_to_get_nodes_info,
|
|
18
|
+
# 2 - The status of the container
|
|
19
|
+
mock_proxmox_to_status_node
|
|
20
|
+
]
|
|
21
|
+
instance.create
|
|
22
|
+
expect(instance.state).to eq :created
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
|
2
|
+
|
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
4
|
+
|
|
5
|
+
context 'checking containers stop' do
|
|
6
|
+
|
|
7
|
+
it 'stops an instance' do
|
|
8
|
+
with_test_proxmox_platform do |instance|
|
|
9
|
+
mock_proxmox_calls_with [
|
|
10
|
+
# 1 - The info on existing containers
|
|
11
|
+
mock_proxmox_to_get_nodes_info,
|
|
12
|
+
# 2 - The start of the container
|
|
13
|
+
mock_proxmox_to_start_node,
|
|
14
|
+
# 3 - The stop of the container
|
|
15
|
+
mock_proxmox_to_stop_node
|
|
16
|
+
]
|
|
17
|
+
instance.create
|
|
18
|
+
instance.start
|
|
19
|
+
instance.stop
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'fails to stop an instance when the Proxmox task ends in error' do
|
|
24
|
+
with_test_proxmox_platform do |instance|
|
|
25
|
+
mock_proxmox_calls_with [
|
|
26
|
+
# 1 - The info on existing containers
|
|
27
|
+
mock_proxmox_to_get_nodes_info,
|
|
28
|
+
# 2 - The start of the container
|
|
29
|
+
mock_proxmox_to_start_node,
|
|
30
|
+
# 3 - The stop of the container
|
|
31
|
+
mock_proxmox_to_stop_node(task_status: 'ERROR')
|
|
32
|
+
]
|
|
33
|
+
instance.create
|
|
34
|
+
instance.start
|
|
35
|
+
expect { instance.stop }.to raise_error '[ node/test ] - Proxmox task UPID:pve_node_name:0000A504:6DEABF24:5F44669B:stop::root@pam: completed with status ERROR'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
|
2
|
+
|
|
3
|
+
context 'checking CMDB plugin Config' do
|
|
4
|
+
|
|
5
|
+
it 'sets global metadata' do
|
|
6
|
+
with_test_platform(
|
|
7
|
+
{ nodes: { 'node1' => {} } },
|
|
8
|
+
false,
|
|
9
|
+
'set_metadata(my_property: \'my_value\')'
|
|
10
|
+
) do
|
|
11
|
+
expect(cmdb(:config).get_others(['node1'], {})).to eq('node1' => { my_property: 'my_value' })
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'sets different metadata for different nodes' do
|
|
16
|
+
with_test_platform(
|
|
17
|
+
{ nodes: { 'node1' => {}, 'node2' => {} } },
|
|
18
|
+
false,
|
|
19
|
+
'
|
|
20
|
+
for_nodes(\'node1\') { set_metadata(my_property1: \'my_value1\', my_property2: \'my_value2\') }
|
|
21
|
+
for_nodes(\'node2\') { set_metadata(my_property2: \'my_value3\', my_property3: \'my_value4\') }
|
|
22
|
+
'
|
|
23
|
+
) do
|
|
24
|
+
expect(cmdb(:config).get_others(%w[node1 node2], {})).to eq(
|
|
25
|
+
'node1' => { my_property1: 'my_value1', my_property2: 'my_value2' },
|
|
26
|
+
'node2' => { my_property2: 'my_value3', my_property3: 'my_value4' }
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
|
2
|
+
|
|
3
|
+
context 'checking CMDB plugin HostIp' do
|
|
4
|
+
|
|
5
|
+
it 'makes sure to have hostname set to compute host_ip' do
|
|
6
|
+
with_test_platform do
|
|
7
|
+
expect(cmdb(:host_ip).property_dependencies[:host_ip]).to eq :hostname
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'does not return a host IP when hostname is not set' do
|
|
12
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
13
|
+
expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { property: 'value' } })).to eq({})
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'returns a host IP when hostname is set' do
|
|
18
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
19
|
+
with_cmd_runner_mocked([
|
|
20
|
+
['getent hosts my_domain.my_host', proc { [0, '192.168.42.42 my_domain.my_host', ''] }]
|
|
21
|
+
]) do
|
|
22
|
+
expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq('test_node' => '192.168.42.42')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'does not return a host IP when getent can\'t retrieve it' do
|
|
28
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
29
|
+
with_cmd_runner_mocked([
|
|
30
|
+
['getent hosts my_domain.my_host', proc { [0, '', ''] }]
|
|
31
|
+
]) do
|
|
32
|
+
expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq({})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'returns a host IPs for the maximum hosts it can from the list' do
|
|
38
|
+
with_test_platform(nodes: {
|
|
39
|
+
'test_node1' => {},
|
|
40
|
+
'test_node2' => {},
|
|
41
|
+
'test_node3' => {},
|
|
42
|
+
'test_node4' => {}
|
|
43
|
+
}) do
|
|
44
|
+
with_cmd_runner_mocked([
|
|
45
|
+
['getent hosts my_domain.my_host1', proc { [0, '192.168.42.1 my_domain.my_host1', ''] }],
|
|
46
|
+
['getent hosts my_domain.my_host2', proc { [0, '', ''] }],
|
|
47
|
+
['getent hosts my_domain.my_host4', proc { [0, '192.168.42.4 my_domain.my_host4', ''] }],
|
|
48
|
+
]) do
|
|
49
|
+
expect(cmdb(:host_ip).get_host_ip(['test_node'], {
|
|
50
|
+
'test_node1' => { hostname: 'my_domain.my_host1' },
|
|
51
|
+
'test_node2' => { hostname: 'my_domain.my_host2' },
|
|
52
|
+
'test_node3' => {},
|
|
53
|
+
'test_node4' => { hostname: 'my_domain.my_host4' }
|
|
54
|
+
})).to eq(
|
|
55
|
+
'test_node1' => '192.168.42.1',
|
|
56
|
+
'test_node4' => '192.168.42.4'
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
|
2
|
+
|
|
3
|
+
context 'checking CMDB plugin HostKeys' do
|
|
4
|
+
|
|
5
|
+
it 'makes sure to have hostname or host_ip set to compute host_keys' do
|
|
6
|
+
with_test_platform do
|
|
7
|
+
expect(cmdb(:host_keys).property_dependencies[:host_keys].sort).to eq %i[hostname host_ip].sort
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'does not return host keys when neither hostname nor host_ip are set' do
|
|
12
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
13
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { property: 'value' } })).to eq({})
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'returns host keys when hostname is set' do
|
|
18
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
19
|
+
with_cmd_runner_mocked([
|
|
20
|
+
['ssh-keyscan my_host.my_domain', proc { [0, "my_host.my_domain ssh-rsa fake_host_key\n", ''] }]
|
|
21
|
+
]) do
|
|
22
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { hostname: 'my_host.my_domain' } })).to eq('test_node' => ['ssh-rsa fake_host_key'])
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'returns host keys when host_ip is set' do
|
|
28
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
29
|
+
with_cmd_runner_mocked([
|
|
30
|
+
['ssh-keyscan 192.168.42.42', proc { [0, "192.168.42.42 ssh-rsa fake_host_key\n", ''] }]
|
|
31
|
+
]) do
|
|
32
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { host_ip: '192.168.42.42' } })).to eq('test_node' => ['ssh-rsa fake_host_key'])
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'returns several host keys' do
|
|
38
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
39
|
+
with_cmd_runner_mocked([
|
|
40
|
+
['ssh-keyscan 192.168.42.42', proc do
|
|
41
|
+
[0, <<~EOS, '']
|
|
42
|
+
192.168.42.42 ssh-rsa fake_host_key_rsa
|
|
43
|
+
192.168.42.42 ssh-ed25519 fake_host_key_ed25519
|
|
44
|
+
EOS
|
|
45
|
+
end]
|
|
46
|
+
]) do
|
|
47
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { host_ip: '192.168.42.42' } })).to eq('test_node' => [
|
|
48
|
+
'ssh-rsa fake_host_key_rsa',
|
|
49
|
+
'ssh-ed25519 fake_host_key_ed25519'
|
|
50
|
+
].sort)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'returns several host keys and ignores comments from ssh-keyscan' do
|
|
56
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
57
|
+
with_cmd_runner_mocked([
|
|
58
|
+
['ssh-keyscan 192.168.42.42', proc do
|
|
59
|
+
[0, <<~EOS, '']
|
|
60
|
+
# That's a comment
|
|
61
|
+
192.168.42.42 ssh-rsa fake_host_key_rsa
|
|
62
|
+
# And another one
|
|
63
|
+
192.168.42.42 ssh-ed25519 fake_host_key_ed25519
|
|
64
|
+
# Woot third!
|
|
65
|
+
EOS
|
|
66
|
+
end]
|
|
67
|
+
]) do
|
|
68
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { host_ip: '192.168.42.42' } })).to eq('test_node' => [
|
|
69
|
+
'ssh-rsa fake_host_key_rsa',
|
|
70
|
+
'ssh-ed25519 fake_host_key_ed25519'
|
|
71
|
+
].sort)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'returns host keys sorted' do
|
|
77
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
78
|
+
with_cmd_runner_mocked([
|
|
79
|
+
['ssh-keyscan 192.168.42.42', proc do
|
|
80
|
+
[0, <<~EOS, '']
|
|
81
|
+
192.168.42.42 ssh-dsa fake_host_key_dsa
|
|
82
|
+
192.168.42.42 ssh-rsa fake_host_key_rsa
|
|
83
|
+
192.168.42.42 ssh-ed25519 fake_host_key_ed25519
|
|
84
|
+
EOS
|
|
85
|
+
end]
|
|
86
|
+
]) do
|
|
87
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { host_ip: '192.168.42.42' } })).to eq('test_node' => [
|
|
88
|
+
'ssh-dsa fake_host_key_dsa',
|
|
89
|
+
'ssh-ed25519 fake_host_key_ed25519',
|
|
90
|
+
'ssh-rsa fake_host_key_rsa'
|
|
91
|
+
])
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'does not return host keys when ssh-keyscan can\'t retrieve them' do
|
|
97
|
+
with_test_platform(nodes: { 'test_node' => {} }) do
|
|
98
|
+
with_cmd_runner_mocked([
|
|
99
|
+
['ssh-keyscan 192.168.42.42', proc { [0, '', ''] }]
|
|
100
|
+
]) do
|
|
101
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], { 'test_node' => { host_ip: '192.168.42.42' } })).to eq({})
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it 'returns host keys for the maximum hosts it can from the list' do
|
|
107
|
+
with_test_platform(nodes: {
|
|
108
|
+
'test_node1' => {},
|
|
109
|
+
'test_node2' => {},
|
|
110
|
+
'test_node3' => {},
|
|
111
|
+
'test_node4' => {}
|
|
112
|
+
}) do
|
|
113
|
+
with_cmd_runner_mocked([
|
|
114
|
+
['ssh-keyscan 192.168.42.1', proc { [0, "192.168.42.1 ssh-rsa fake_host_key_1\n", ''] }],
|
|
115
|
+
['ssh-keyscan 192.168.42.2', proc { [0, '', ''] }],
|
|
116
|
+
['ssh-keyscan my_host_4.my_domain', proc { [0, "my_host_4.my_domain ssh-rsa fake_host_key_4\n", ''] }],
|
|
117
|
+
]) do
|
|
118
|
+
expect(cmdb(:host_keys).get_host_keys(['test_node'], {
|
|
119
|
+
'test_node1' => { host_ip: '192.168.42.1' },
|
|
120
|
+
'test_node2' => { host_ip: '192.168.42.2' },
|
|
121
|
+
'test_node3' => {},
|
|
122
|
+
'test_node4' => { hostname: 'my_host_4.my_domain' }
|
|
123
|
+
})).to eq(
|
|
124
|
+
'test_node1' => ['ssh-rsa fake_host_key_1'],
|
|
125
|
+
'test_node4' => ['ssh-rsa fake_host_key_4']
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|