hybrid_platforms_conductor 32.17.0 → 33.0.2
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 +4 -4
- data/CHANGELOG.md +36 -0
- data/README.md +6 -3
- data/bin/check-node +0 -1
- data/bin/deploy +0 -1
- data/bin/get_impacted_nodes +0 -1
- data/bin/last_deploys +12 -8
- data/bin/nodes_to_deploy +6 -6
- data/bin/setup +6 -6
- data/bin/topograph +1 -1
- data/docs/config_dsl.md +45 -1
- data/docs/executables.md +6 -7
- data/docs/executables/check-node.md +3 -3
- data/docs/executables/deploy.md +3 -3
- data/docs/executables/dump_nodes_json.md +3 -3
- data/docs/executables/test.md +3 -3
- data/docs/executables/topograph.md +3 -3
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/plugins.md +46 -0
- data/docs/plugins/connector/ssh.md +1 -1
- data/docs/plugins/log/remote_fs.md +26 -0
- data/docs/plugins/secrets_reader/cli.md +31 -0
- data/docs/plugins/secrets_reader/thycotic.md +46 -0
- data/docs/plugins/test/check_deploy_and_idempotence.md +1 -1
- data/docs/plugins/test/connection.md +1 -0
- data/docs/plugins/test/deploy_removes_root_access.md +1 -1
- data/docs/plugins/test/file_system.md +1 -0
- data/docs/plugins/test/hostname.md +1 -0
- data/docs/plugins/test/ip.md +1 -0
- data/docs/plugins/test/local_users.md +1 -0
- data/docs/plugins/test/mounts.md +1 -0
- data/docs/plugins/test/orphan_files.md +1 -0
- data/docs/plugins/test/ports.md +1 -0
- data/docs/plugins/test/spectre.md +1 -0
- data/docs/plugins/test/vulnerabilities.md +1 -0
- data/lib/hybrid_platforms_conductor/action.rb +4 -4
- data/lib/hybrid_platforms_conductor/actions_executor.rb +45 -43
- data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
- data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +4 -3
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
- data/lib/hybrid_platforms_conductor/config.rb +8 -4
- data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/connector.rb +5 -2
- data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +116 -0
- data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
- data/lib/hybrid_platforms_conductor/deployer.rb +275 -224
- data/lib/hybrid_platforms_conductor/executable.rb +20 -15
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/my_log_plugin.rb.sample +100 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +180 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/my_secrets_reader_plugin.rb.sample +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +90 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +2 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +13 -10
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +7 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +27 -25
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
- data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
- data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
- data/lib/hybrid_platforms_conductor/log.rb +31 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
- data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
- data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
- data/lib/hybrid_platforms_conductor/plugins.rb +14 -8
- data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
- data/lib/hybrid_platforms_conductor/report.rb +2 -2
- data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
- data/lib/hybrid_platforms_conductor/secrets_reader.rb +31 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
- data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +18 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
- data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
- data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
- data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +33 -12
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +18 -11
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +32 -21
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +75 -49
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +27 -15
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +90 -59
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +46 -44
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +106 -75
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +167 -142
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +16 -16
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
- data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +43 -5
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +199 -216
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +268 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +5 -4
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +159 -113
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +299 -160
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -196
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +245 -56
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +84 -0
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +105 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +45 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
- data/spec/spec_helper.rb +17 -18
- data/tools/check_md +16 -20
- data/tools/generate_mermaid +1 -1
- metadata +195 -144
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'English'
|
|
1
2
|
require 'optparse'
|
|
2
3
|
require 'logger'
|
|
3
4
|
require 'hybrid_platforms_conductor/config'
|
|
@@ -43,8 +44,8 @@ module HybridPlatformsConductor
|
|
|
43
44
|
parallel_options: true,
|
|
44
45
|
timeout_options: true,
|
|
45
46
|
deploy_options: true,
|
|
46
|
-
logger: Logger.new(
|
|
47
|
-
logger_stderr: Logger.new(
|
|
47
|
+
logger: Logger.new($stdout, level: :info),
|
|
48
|
+
logger_stderr: Logger.new($stderr, level: :info),
|
|
48
49
|
&opts_block
|
|
49
50
|
)
|
|
50
51
|
init_loggers(logger, logger_stderr)
|
|
@@ -92,11 +93,13 @@ module HybridPlatformsConductor
|
|
|
92
93
|
# Result::
|
|
93
94
|
# * Object: The corresponding component
|
|
94
95
|
define_method(component) do
|
|
95
|
-
@instantiated_components
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
unless @instantiated_components.key?(component)
|
|
97
|
+
@instantiated_components[component] = HybridPlatformsConductor.const_get(component.to_s.split('_').collect(&:capitalize).join.to_sym).new(
|
|
98
|
+
logger: @logger,
|
|
99
|
+
logger_stderr: @logger_stderr,
|
|
100
|
+
**dependencies.map { |dependency| [dependency, send(dependency)] }.to_h
|
|
101
|
+
)
|
|
102
|
+
end
|
|
100
103
|
@instantiated_components[component]
|
|
101
104
|
end
|
|
102
105
|
|
|
@@ -107,7 +110,7 @@ module HybridPlatformsConductor
|
|
|
107
110
|
# Handle common options (like logging and help).
|
|
108
111
|
def parse_options!
|
|
109
112
|
OptionParser.new do |opts|
|
|
110
|
-
opts.banner = "Usage: #{$
|
|
113
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
|
111
114
|
opts.separator ''
|
|
112
115
|
opts.separator 'Main options:'
|
|
113
116
|
opts.on('-d', '--debug', 'Activate debug mode') do
|
|
@@ -117,17 +120,19 @@ module HybridPlatformsConductor
|
|
|
117
120
|
out opts
|
|
118
121
|
exit 0
|
|
119
122
|
end
|
|
120
|
-
@opts_block
|
|
123
|
+
@opts_block&.call(opts)
|
|
121
124
|
nodes_handler.options_parse(opts) if nodes_handler_instantiated?
|
|
122
125
|
nodes_handler.options_parse_nodes_selectors(opts, @selected_nodes) if @nodes_selection_options
|
|
123
126
|
cmd_runner.options_parse(opts) if cmd_runner_instantiated?
|
|
124
127
|
actions_executor.options_parse(opts, parallel: @parallel_options) if actions_executor_instantiated?
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if deployer_instantiated? && @deploy_options
|
|
129
|
+
deployer.options_parse(
|
|
130
|
+
opts,
|
|
131
|
+
parallel_switch: @parallel_options,
|
|
132
|
+
timeout_options: @timeout_options,
|
|
133
|
+
why_run_switch: @check_options
|
|
134
|
+
)
|
|
135
|
+
end
|
|
131
136
|
json_dumper.options_parse(opts) if json_dumper_instantiated?
|
|
132
137
|
reports_handler.options_parse(opts) if reports_handler_instantiated?
|
|
133
138
|
tests_runner.options_parse(opts) if tests_runner_instantiated?
|
|
@@ -21,6 +21,8 @@ module HybridPlatformsConductor
|
|
|
21
21
|
@nodes_metadata = []
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
# As this is used in a DSL, keep the method as a setter using set_, otherwise it will be confused with simple variables if used like metadata =
|
|
25
|
+
# rubocop:disable Naming/AccessorMethodName
|
|
24
26
|
# Set metadata associated to the nodes
|
|
25
27
|
#
|
|
26
28
|
# Parameters::
|
|
@@ -31,6 +33,7 @@ module HybridPlatformsConductor
|
|
|
31
33
|
nodes_selectors_stack: current_nodes_selectors_stack
|
|
32
34
|
}
|
|
33
35
|
end
|
|
36
|
+
# rubocop:enable Naming/AccessorMethodName
|
|
34
37
|
|
|
35
38
|
end
|
|
36
39
|
|
|
@@ -55,16 +58,16 @@ module HybridPlatformsConductor
|
|
|
55
58
|
# Result::
|
|
56
59
|
# * Hash<String, Hash<Symbol,Object> >: The corresponding properties, per required node.
|
|
57
60
|
# Nodes for which the property can't be fetched can be ommitted.
|
|
58
|
-
def get_others(nodes,
|
|
61
|
+
def get_others(nodes, _metadata)
|
|
59
62
|
# Keep metadata values in a cache, per node
|
|
60
63
|
@cached_metadata = {} unless defined?(@cached_metadata)
|
|
61
64
|
nodes.each do |node|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
next if @cached_metadata.key?(node)
|
|
66
|
+
|
|
67
|
+
@cached_metadata[node] = @nodes_handler.
|
|
68
|
+
select_confs_for_node(node, @config.nodes_metadata).
|
|
69
|
+
map { |nodes_metadata_info| nodes_metadata_info[:metadata] }.
|
|
70
|
+
inject({}) { |merged_metadata, node_metadata| merged_metadata.merge(node_metadata) }
|
|
68
71
|
end
|
|
69
72
|
@cached_metadata.slice(*nodes)
|
|
70
73
|
end
|
|
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
|
|
|
39
39
|
# Result::
|
|
40
40
|
# * Hash<String, Object>: The corresponding property, per required node.
|
|
41
41
|
# Nodes for which the property can't be fetched can be ommitted.
|
|
42
|
-
def get_host_ip(
|
|
42
|
+
def get_host_ip(_nodes, metadata)
|
|
43
43
|
updated_metadata = {}
|
|
44
44
|
# Get the list of nodes, per hostname (just in case several nodes share the same hostname)
|
|
45
45
|
# Hash<String, Array<String> >
|
|
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
|
|
|
39
39
|
# Result::
|
|
40
40
|
# * Hash<String, Object>: The corresponding property, per required node.
|
|
41
41
|
# Nodes for which the property can't be fetched can be ommitted.
|
|
42
|
-
def get_host_keys(
|
|
42
|
+
def get_host_keys(_nodes, metadata)
|
|
43
43
|
updated_metadata = {}
|
|
44
44
|
# Get the list of nodes, per hostname (just in case several nodes share the same hostname)
|
|
45
45
|
# Hash<String, Array<String> >
|
|
@@ -89,7 +89,7 @@ module HybridPlatformsConductor
|
|
|
89
89
|
log_to_stdout: log_debug?,
|
|
90
90
|
no_exception: true
|
|
91
91
|
)
|
|
92
|
-
if exit_status
|
|
92
|
+
if exit_status.zero?
|
|
93
93
|
found_keys = []
|
|
94
94
|
stdout.split("\n").each do |line|
|
|
95
95
|
unless line =~ /^# .*$/
|
|
@@ -22,8 +22,8 @@ module HybridPlatformsConductor
|
|
|
22
22
|
# Result::
|
|
23
23
|
# * Hash<String, Object>: The corresponding property, per required node.
|
|
24
24
|
# Nodes for which the property can't be fetched can be ommitted.
|
|
25
|
-
def get_services(nodes,
|
|
26
|
-
|
|
25
|
+
def get_services(nodes, _metadata)
|
|
26
|
+
nodes.map { |node| [node, platform_for(node).services_for(node)] }.to_h
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Get other properties for a given set of nodes.
|
|
@@ -41,8 +41,8 @@ module HybridPlatformsConductor
|
|
|
41
41
|
# Result::
|
|
42
42
|
# * Hash<String, Hash<Symbol,Object> >: The corresponding properties, per required node.
|
|
43
43
|
# Nodes for which the property can't be fetched can be ommitted.
|
|
44
|
-
def get_others(nodes,
|
|
45
|
-
|
|
44
|
+
def get_others(nodes, _metadata)
|
|
45
|
+
nodes.map { |node| [node, platform_for(node).metadata_for(node)] }.to_h
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
private
|
|
@@ -53,6 +53,7 @@ module HybridPlatformsConductor
|
|
|
53
53
|
system "cd #{workspace_for(@node)} ; /bin/bash"
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
|
56
57
|
# Copy a file to the remote node in a directory
|
|
57
58
|
# [API] - This method is mandatory
|
|
58
59
|
# [API] - If defined, then with_connection_to has been called before this method.
|
|
@@ -74,6 +75,7 @@ module HybridPlatformsConductor
|
|
|
74
75
|
to = "#{workspace_for(@node)}/#{to}" unless to.start_with?('/')
|
|
75
76
|
FileUtils.cp_r from, to
|
|
76
77
|
end
|
|
78
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
|
77
79
|
|
|
78
80
|
private
|
|
79
81
|
|
|
@@ -14,6 +14,7 @@ module HybridPlatformsConductor
|
|
|
14
14
|
class NotConnectableError < RuntimeError
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Config DSL extension
|
|
17
18
|
module PlatformsDslSsh
|
|
18
19
|
|
|
19
20
|
# List of SSH connection transformations:
|
|
@@ -59,6 +60,7 @@ module HybridPlatformsConductor
|
|
|
59
60
|
# * *ssh_def_erb* (String): Corresponding SSH ERB configuration
|
|
60
61
|
def gateway(gateway_conf, ssh_def_erb)
|
|
61
62
|
raise "Gateway #{gateway_conf} already defined to #{@gateways[gateway_conf]}" if @gateways.key?(gateway_conf)
|
|
63
|
+
|
|
62
64
|
@gateways[gateway_conf] = ssh_def_erb
|
|
63
65
|
end
|
|
64
66
|
|
|
@@ -78,18 +80,18 @@ module HybridPlatformsConductor
|
|
|
78
80
|
# Result::
|
|
79
81
|
# * String: The corresponding SSH configuration
|
|
80
82
|
def ssh_for_gateway(gateway_conf, variables = {})
|
|
81
|
-
erb_context =
|
|
82
|
-
def erb_context.
|
|
83
|
+
erb_context = clone
|
|
84
|
+
def erb_context.private_binding
|
|
83
85
|
binding
|
|
84
86
|
end
|
|
85
87
|
variables.each do |var_name, var_value|
|
|
86
88
|
erb_context.instance_variable_set("@#{var_name}".to_sym, var_value)
|
|
87
89
|
end
|
|
88
|
-
ERB.new(@gateways[gateway_conf]).result(erb_context.
|
|
90
|
+
ERB.new(@gateways[gateway_conf]).result(erb_context.private_binding)
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
end
|
|
92
|
-
|
|
94
|
+
extend_config_dsl_with PlatformsDslSsh, :init_ssh
|
|
93
95
|
|
|
94
96
|
# Name of the gateway user to be used. [default: ENV['hpc_ssh_gateway_user'] or ubradm]
|
|
95
97
|
# String
|
|
@@ -174,7 +176,7 @@ module HybridPlatformsConductor
|
|
|
174
176
|
options_parser.on('-w', '--password', 'If used, then expect SSH connections to ask for a password.') do
|
|
175
177
|
@auth_password = true
|
|
176
178
|
end
|
|
177
|
-
options_parser.on('-y', '--ssh-gateways-conf GATEWAYS_CONF',
|
|
179
|
+
options_parser.on('-y', '--ssh-gateways-conf GATEWAYS_CONF', 'Name of the gateways configuration to be used. Can also be set from environment variable hpc_ssh_gateways_conf.') do |gateway|
|
|
178
180
|
@ssh_gateways_conf = gateway.to_sym
|
|
179
181
|
end
|
|
180
182
|
end
|
|
@@ -185,6 +187,7 @@ module HybridPlatformsConductor
|
|
|
185
187
|
# [API] - @nodes_handler can be used
|
|
186
188
|
def validate_params
|
|
187
189
|
raise 'No SSH user name specified. Please use --ssh-user option or hpc_ssh_user environment variable to set it.' if @ssh_user.nil? || @ssh_user.empty?
|
|
190
|
+
|
|
188
191
|
known_gateways = @config.known_gateways
|
|
189
192
|
raise "Unknown gateway configuration provided: #{@ssh_gateways_conf}. Possible values are: #{known_gateways.join(', ')}." if !@ssh_gateways_conf.nil? && !known_gateways.include?(@ssh_gateways_conf)
|
|
190
193
|
end
|
|
@@ -212,13 +215,11 @@ module HybridPlatformsConductor
|
|
|
212
215
|
# Parameters::
|
|
213
216
|
# * *nodes* (Array<String>): Nodes to prepare the connection to
|
|
214
217
|
# * *no_exception* (Boolean): Should we still continue if some nodes have connection errors? [default: false]
|
|
215
|
-
# * Proc: Code called with the connections prepared.
|
|
218
|
+
# * *block* (Proc): Code called with the connections prepared.
|
|
216
219
|
# * Parameters::
|
|
217
220
|
# * *connected_nodes* (Array<String>): The list of connected nodes (should be equal to nodes unless no_exception == true and some nodes failed to connect)
|
|
218
|
-
def with_connection_to(nodes, no_exception: false)
|
|
219
|
-
with_ssh_master_to(nodes, no_exception: no_exception)
|
|
220
|
-
yield connected_nodes
|
|
221
|
-
end
|
|
221
|
+
def with_connection_to(nodes, no_exception: false, &block)
|
|
222
|
+
with_ssh_master_to(nodes, no_exception: no_exception, &block)
|
|
222
223
|
end
|
|
223
224
|
|
|
224
225
|
# Integer: Max size for an argument that can be executed without getting through an intermediary file
|
|
@@ -251,7 +252,7 @@ module HybridPlatformsConductor
|
|
|
251
252
|
temp_file = "#{Dir.tmpdir}/hpc_temp_cmds_#{Digest::MD5.hexdigest(bash_cmds)}.sh"
|
|
252
253
|
File.open(temp_file, 'w+') do |file|
|
|
253
254
|
file.write ssh_cmd
|
|
254
|
-
file.chmod
|
|
255
|
+
file.chmod 0o700
|
|
255
256
|
end
|
|
256
257
|
begin
|
|
257
258
|
run_cmd(temp_file)
|
|
@@ -311,7 +312,7 @@ module HybridPlatformsConductor
|
|
|
311
312
|
run_cmd "scp -S #{ssh_exec} #{from} #{ssh_url}:#{to}"
|
|
312
313
|
end
|
|
313
314
|
else
|
|
314
|
-
run_cmd <<~
|
|
315
|
+
run_cmd <<~EO_BASH
|
|
315
316
|
cd #{File.dirname(from)} && \
|
|
316
317
|
tar \
|
|
317
318
|
--create \
|
|
@@ -329,7 +330,7 @@ module HybridPlatformsConductor
|
|
|
329
330
|
--directory #{to} \
|
|
330
331
|
--owner root \
|
|
331
332
|
\"
|
|
332
|
-
|
|
333
|
+
EO_BASH
|
|
333
334
|
end
|
|
334
335
|
end
|
|
335
336
|
|
|
@@ -358,7 +359,7 @@ module HybridPlatformsConductor
|
|
|
358
359
|
# Result::
|
|
359
360
|
# * String: The SSH config
|
|
360
361
|
def ssh_config(ssh_exec: 'ssh', known_hosts_file: nil, nodes: @nodes_handler.known_nodes)
|
|
361
|
-
config_content = <<~
|
|
362
|
+
config_content = <<~EO_SSH_CONFIG
|
|
362
363
|
############
|
|
363
364
|
# GATEWAYS #
|
|
364
365
|
############
|
|
@@ -369,7 +370,7 @@ module HybridPlatformsConductor
|
|
|
369
370
|
# ENDPOINTS #
|
|
370
371
|
#############
|
|
371
372
|
|
|
372
|
-
|
|
373
|
+
EO_SSH_CONFIG
|
|
373
374
|
|
|
374
375
|
# Add each node
|
|
375
376
|
# Query for the metadata of all nodes at once
|
|
@@ -393,7 +394,7 @@ module HybridPlatformsConductor
|
|
|
393
394
|
config_content << "\n"
|
|
394
395
|
end
|
|
395
396
|
# Add global definitions at the end of the SSH config, as they might be overriden by previous ones, and first match wins.
|
|
396
|
-
config_content << <<~
|
|
397
|
+
config_content << <<~EO_SSH_CONFIG
|
|
397
398
|
###########
|
|
398
399
|
# GLOBALS #
|
|
399
400
|
###########
|
|
@@ -406,7 +407,7 @@ module HybridPlatformsConductor
|
|
|
406
407
|
#{known_hosts_file.nil? ? '' : "UserKnownHostsFile #{known_hosts_file}"}
|
|
407
408
|
#{@ssh_strict_host_key_checking ? '' : 'StrictHostKeyChecking no'}
|
|
408
409
|
|
|
409
|
-
|
|
410
|
+
EO_SSH_CONFIG
|
|
410
411
|
config_content
|
|
411
412
|
end
|
|
412
413
|
|
|
@@ -421,7 +422,7 @@ module HybridPlatformsConductor
|
|
|
421
422
|
cache_filled = defined?(@ssh_pass_installed)
|
|
422
423
|
unless cache_filled
|
|
423
424
|
exit_code, _stdout, _stderr = @cmd_runner.run_cmd 'sshpass -V', log_to_stdout: log_debug?, no_exception: true
|
|
424
|
-
@ssh_pass_installed =
|
|
425
|
+
@ssh_pass_installed = exit_code.zero?
|
|
425
426
|
end
|
|
426
427
|
@ssh_pass_installed
|
|
427
428
|
end
|
|
@@ -518,12 +519,10 @@ module HybridPlatformsConductor
|
|
|
518
519
|
# We'll do that using another terminal spawned in the background.
|
|
519
520
|
if ENV['hpc_interactive'] == 'false'
|
|
520
521
|
error = "Can't spawn interactive ControlMaster to #{node} in non-interactive mode. You may want to change the hpc_interactive env variable."
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
raise error
|
|
526
|
-
end
|
|
522
|
+
raise error unless no_exception
|
|
523
|
+
|
|
524
|
+
log_error error
|
|
525
|
+
exit_status = :non_interactive
|
|
527
526
|
else
|
|
528
527
|
Thread.new do
|
|
529
528
|
log_debug "[ ControlMaster - #{ssh_url} ] - Spawn interactive ControlMaster in separate terminal"
|
|
@@ -540,17 +539,14 @@ module HybridPlatformsConductor
|
|
|
540
539
|
ssh_control_master_start_cmd = "#{ssh_exec}#{@passwords.key?(node) || @auth_password ? '' : ' -o BatchMode=yes'} -o ControlMaster=yes -o ControlPersist=yes #{ssh_url} true"
|
|
541
540
|
idx_try = 0
|
|
542
541
|
loop do
|
|
543
|
-
stderr = nil
|
|
544
542
|
exit_status, _stdout, stderr = @cmd_runner.run_cmd ssh_control_master_start_cmd, log_to_stdout: log_debug?, no_exception: true, timeout: timeout
|
|
545
|
-
if exit_status
|
|
546
|
-
|
|
547
|
-
|
|
543
|
+
break if exit_status.zero?
|
|
544
|
+
|
|
545
|
+
if stderr =~ /System is booting up/
|
|
548
546
|
if idx_try == MAX_RETRIES_FOR_BOOT
|
|
549
|
-
if no_exception
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
raise ActionsExecutor::ConnectionError, "Tried #{idx_try} times to create SSH Control Master with #{ssh_control_master_start_cmd} but system says it's booting up."
|
|
553
|
-
end
|
|
547
|
+
break if no_exception
|
|
548
|
+
|
|
549
|
+
raise ActionsExecutor::ConnectionError, "Tried #{idx_try} times to create SSH Control Master with #{ssh_control_master_start_cmd} but system says it's booting up."
|
|
554
550
|
end
|
|
555
551
|
# Wait a bit and try again
|
|
556
552
|
idx_try += 1
|
|
@@ -563,7 +559,7 @@ module HybridPlatformsConductor
|
|
|
563
559
|
end
|
|
564
560
|
end
|
|
565
561
|
end
|
|
566
|
-
if exit_status
|
|
562
|
+
if exit_status.zero?
|
|
567
563
|
log_debug "[ ControlMaster - #{ssh_url} ] - ControlMaster created"
|
|
568
564
|
working_master = true
|
|
569
565
|
else
|
|
@@ -579,7 +575,7 @@ module HybridPlatformsConductor
|
|
|
579
575
|
rescue CmdRunner::UnexpectedExitCodeError
|
|
580
576
|
raise ActionsExecutor::ConnectionError, "Error while checking SSH Control Master with #{ssh_control_master_check_cmd}"
|
|
581
577
|
end
|
|
582
|
-
if exit_status
|
|
578
|
+
if exit_status.zero?
|
|
583
579
|
log_debug "[ ControlMaster - #{ssh_url} ] - ControlMaster checked ok"
|
|
584
580
|
working_master = true
|
|
585
581
|
else
|
|
@@ -597,17 +593,17 @@ module HybridPlatformsConductor
|
|
|
597
593
|
end
|
|
598
594
|
else
|
|
599
595
|
# We have not created any ControlMaster, but still consider the nodes to be ready to connect
|
|
600
|
-
user_locks =
|
|
596
|
+
user_locks = nodes.map { |node| [node, nil] }.to_h
|
|
601
597
|
end
|
|
602
598
|
yield user_locks.keys
|
|
603
599
|
ensure
|
|
604
600
|
if @ssh_use_control_master
|
|
605
601
|
user_locks_mutex.synchronize do
|
|
606
602
|
user_locks.each do |node, user_id|
|
|
607
|
-
with_lock_on_control_master_for(node, user_id: user_id) do |current_users,
|
|
603
|
+
with_lock_on_control_master_for(node, user_id: user_id) do |current_users, current_user_id|
|
|
608
604
|
ssh_url = "hpc.#{node}"
|
|
609
|
-
log_warn "[ ControlMaster - #{ssh_url} ] - Current process/thread was not part of the ControlMaster users anymore whereas it should have been" unless current_users.include?(
|
|
610
|
-
remaining_users = current_users - [
|
|
605
|
+
log_warn "[ ControlMaster - #{ssh_url} ] - Current process/thread was not part of the ControlMaster users anymore whereas it should have been" unless current_users.include?(current_user_id)
|
|
606
|
+
remaining_users = current_users - [current_user_id]
|
|
611
607
|
if remaining_users.empty?
|
|
612
608
|
# Stop the ControlMaster
|
|
613
609
|
log_debug "[ ControlMaster - #{ssh_url} ] - Stopping ControlMaster..."
|
|
@@ -693,14 +689,15 @@ module HybridPlatformsConductor
|
|
|
693
689
|
# * *nodes* (Array<String>): List of nodes for which we need the config to be created [default: @nodes_handler.known_nodes ]
|
|
694
690
|
# * Proc: Code called with the given ssh executable to be used to get TI config
|
|
695
691
|
def with_platforms_ssh(nodes: @nodes_handler.known_nodes)
|
|
696
|
-
platforms_ssh_dir = Dir.mktmpdir("platforms_ssh_#{
|
|
692
|
+
platforms_ssh_dir = Dir.mktmpdir("platforms_ssh_#{object_id}", @tmp_dir)
|
|
697
693
|
log_debug "Generate temporary SSH configuration in #{platforms_ssh_dir} for #{nodes.size} nodes..."
|
|
698
694
|
begin
|
|
699
695
|
ssh_conf_file = "#{platforms_ssh_dir}/ssh_config"
|
|
700
696
|
ssh_exec_file = "#{platforms_ssh_dir}/ssh"
|
|
701
697
|
known_hosts_file = "#{platforms_ssh_dir}/known_hosts"
|
|
702
698
|
raise 'sshpass is not installed. Can\'t use automatic passwords handling without it. Please install it.' if !@passwords.empty? && !ssh_pass_installed?
|
|
703
|
-
|
|
699
|
+
|
|
700
|
+
File.open(ssh_exec_file, 'w+', 0o700) do |file|
|
|
704
701
|
file.puts "#!#{env_system_path} bash"
|
|
705
702
|
# TODO: Make a mechanism that uses sshpass and the correct password only for the correct hostname (this requires parsing ssh parameters $*).
|
|
706
703
|
# Current implementation is much simpler: it uses sshpass if at least 1 password is needed, and always uses the first password.
|
|
@@ -709,17 +706,17 @@ module HybridPlatformsConductor
|
|
|
709
706
|
end
|
|
710
707
|
File.write(ssh_conf_file, ssh_config(ssh_exec: ssh_exec_file, known_hosts_file: known_hosts_file, nodes: nodes))
|
|
711
708
|
# Make sure all host keys are setup in the known hosts file
|
|
712
|
-
File.open(known_hosts_file, 'w+',
|
|
709
|
+
File.open(known_hosts_file, 'w+', 0o700) do |file|
|
|
713
710
|
if @ssh_strict_host_key_checking
|
|
714
711
|
# In the case of an overriden connection, get host key for the overriden connection
|
|
715
712
|
@nodes_handler.prefetch_metadata_of nodes, :host_keys
|
|
716
713
|
nodes.sort.each do |node|
|
|
717
714
|
host_keys = @nodes_handler.get_host_keys_of(node)
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
715
|
+
next unless host_keys && !host_keys.empty?
|
|
716
|
+
|
|
717
|
+
connection, _connection_user, _gateway, _gateway_user = connection_info_for(node)
|
|
718
|
+
host_keys.each do |host_key|
|
|
719
|
+
file.puts "#{connection} #{host_key}"
|
|
723
720
|
end
|
|
724
721
|
end
|
|
725
722
|
end
|
|
@@ -763,8 +760,6 @@ module HybridPlatformsConductor
|
|
|
763
760
|
@nodes_handler.get_private_ips_of(node).first
|
|
764
761
|
elsif @nodes_handler.get_hostname_of(node)
|
|
765
762
|
@nodes_handler.get_hostname_of(node)
|
|
766
|
-
else
|
|
767
|
-
nil
|
|
768
763
|
end
|
|
769
764
|
connection_user = @ssh_user
|
|
770
765
|
gateway = @nodes_handler.get_gateway_of node
|
|
@@ -775,6 +770,7 @@ module HybridPlatformsConductor
|
|
|
775
770
|
connection, connection_user, gateway, gateway_user = transform_info[:transform].call(node, connection, connection_user, gateway, gateway_user)
|
|
776
771
|
end
|
|
777
772
|
raise NotConnectableError, "No connection possible to #{node}" if connection.nil? && !no_exception
|
|
773
|
+
|
|
778
774
|
[connection, connection_user, gateway, gateway_user]
|
|
779
775
|
end
|
|
780
776
|
|