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,15 +1,15 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking CMDB plugin PlatformHandlers' do
|
|
3
|
+
context 'when checking CMDB plugin PlatformHandlers' do
|
|
4
4
|
|
|
5
5
|
it 'returns metadata published by the Platform\'s handler' do
|
|
6
|
-
with_test_platform(nodes: { 'test_node' => { meta: { property: 'value' } } }) do
|
|
6
|
+
with_test_platform({ nodes: { 'test_node' => { meta: { property: 'value' } } } }) do
|
|
7
7
|
expect(cmdb(:platform_handlers).get_others(['test_node'], {})).to eq('test_node' => { property: 'value' })
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it 'returns services published by the Platform\'s handler' do
|
|
12
|
-
with_test_platform(nodes: { 'test_node' => { services: %w[service1 service2] } }) do
|
|
12
|
+
with_test_platform({ nodes: { 'test_node' => { services: %w[service1 service2] } } }) do
|
|
13
13
|
expect(cmdb(:platform_handlers).get_services(['test_node'], {})).to eq('test_node' => %w[service1 service2])
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking CMDB plugins\' API called by NodesHandler' do
|
|
3
|
+
context 'when checking CMDB plugins\' API called by NodesHandler' do
|
|
4
4
|
|
|
5
5
|
# Get a test platform ready to test using the test CMDB
|
|
6
6
|
#
|
|
7
7
|
# Parameters::
|
|
8
8
|
# * *cmdbs* (Array<Symbol>): The test CMDBs to register [default: [:test_cmdb]]
|
|
9
|
-
# * *
|
|
9
|
+
# * *additional_config* (String): Additional configuration [default: '']
|
|
10
10
|
# * Proc: The code to be caklled for tests
|
|
11
|
-
def with_cmdb_test_platform(cmdbs: [:test_cmdb],
|
|
11
|
+
def with_cmdb_test_platform(cmdbs: [:test_cmdb], additional_config: '')
|
|
12
12
|
with_test_platform(
|
|
13
13
|
{
|
|
14
14
|
nodes: {
|
|
@@ -18,8 +18,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
18
18
|
'node4' => {}
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
additional_platforms_content
|
|
21
|
+
additional_config: additional_config
|
|
23
22
|
) do
|
|
24
23
|
register_test_cmdb(cmdbs)
|
|
25
24
|
yield
|
|
@@ -205,36 +204,36 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
205
204
|
end
|
|
206
205
|
|
|
207
206
|
it 'tries different CMDBs to get a property until one gives it' do
|
|
208
|
-
with_cmdb_test_platform(cmdbs: %i[test_cmdb
|
|
207
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_2]) do
|
|
209
208
|
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has nothing'
|
|
210
209
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
211
210
|
[:get_nothing, ['node1'], {}]
|
|
212
211
|
]
|
|
213
|
-
expect(cmdb(:
|
|
212
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
214
213
|
[:get_nothing, ['node1'], {}]
|
|
215
214
|
]
|
|
216
215
|
end
|
|
217
216
|
end
|
|
218
217
|
|
|
219
218
|
it 'fails when different CMDBs get a property having conflicting values' do
|
|
220
|
-
with_cmdb_test_platform(cmdbs: %i[test_cmdb
|
|
221
|
-
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error '[CMDB TestCmdb2.different_comment] - Returned a conflicting value for metadata different_comment of node node1: Comment from
|
|
219
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_2]) do
|
|
220
|
+
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error '[CMDB TestCmdb2.different_comment] - Returned a conflicting value for metadata different_comment of node node1: Comment from test_cmdb_2 whereas the value was already set to Comment from test_cmdb'
|
|
222
221
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
223
222
|
[:get_different_comment, ['node1'], {}]
|
|
224
223
|
]
|
|
225
|
-
expect(cmdb(:
|
|
224
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
226
225
|
[:get_different_comment, ['node1'], {}]
|
|
227
226
|
]
|
|
228
227
|
end
|
|
229
228
|
end
|
|
230
229
|
|
|
231
230
|
it 'does not fail when different CMDBs get a property having same values' do
|
|
232
|
-
with_cmdb_test_platform(cmdbs: %i[test_cmdb
|
|
231
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_2]) do
|
|
233
232
|
expect(test_nodes_handler.get_same_comment_of('node1')).to eq 'Comment for node1'
|
|
234
233
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
235
234
|
[:get_same_comment, ['node1'], {}]
|
|
236
235
|
]
|
|
237
|
-
expect(cmdb(:
|
|
236
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
238
237
|
[:get_same_comment, ['node1'], {}]
|
|
239
238
|
]
|
|
240
239
|
end
|
|
@@ -242,12 +241,12 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
242
241
|
|
|
243
242
|
it 'does not fail when different CMDBs get a property having conflicting values but one is defined as priority' do
|
|
244
243
|
with_cmdb_test_platform(
|
|
245
|
-
cmdbs: %i[test_cmdb
|
|
246
|
-
|
|
244
|
+
cmdbs: %i[test_cmdb test_cmdb_2],
|
|
245
|
+
additional_config: 'master_cmdbs(test_cmdb_2: :different_comment)'
|
|
247
246
|
) do
|
|
248
|
-
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from
|
|
247
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb_2'
|
|
249
248
|
expect(cmdb(:test_cmdb).calls).to eq nil
|
|
250
|
-
expect(cmdb(:
|
|
249
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
251
250
|
[:get_different_comment, ['node1'], {}]
|
|
252
251
|
]
|
|
253
252
|
end
|
|
@@ -255,20 +254,20 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
255
254
|
|
|
256
255
|
it 'can configure different priority rules for different properties' do
|
|
257
256
|
with_cmdb_test_platform(
|
|
258
|
-
cmdbs: %i[test_cmdb
|
|
259
|
-
|
|
257
|
+
cmdbs: %i[test_cmdb test_cmdb_2],
|
|
258
|
+
additional_config: '
|
|
260
259
|
master_cmdbs(
|
|
261
|
-
test_cmdb: :
|
|
262
|
-
|
|
260
|
+
test_cmdb: :different_comment_2,
|
|
261
|
+
test_cmdb_2: :different_comment
|
|
263
262
|
)
|
|
264
263
|
'
|
|
265
264
|
) do
|
|
266
|
-
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from
|
|
267
|
-
expect(test_nodes_handler.
|
|
265
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb_2'
|
|
266
|
+
expect(test_nodes_handler.get_different_comment_2_of('node1')).to eq 'Comment2 from test_cmdb'
|
|
268
267
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
269
|
-
[:
|
|
268
|
+
[:get_different_comment_2, ['node1'], { 'node1' => { different_comment: 'Comment from test_cmdb_2' } }]
|
|
270
269
|
]
|
|
271
|
-
expect(cmdb(:
|
|
270
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
272
271
|
[:get_different_comment, ['node1'], {}]
|
|
273
272
|
]
|
|
274
273
|
end
|
|
@@ -276,75 +275,75 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
276
275
|
|
|
277
276
|
it 'can configure different priority rules for different properties on different nodes' do
|
|
278
277
|
with_cmdb_test_platform(
|
|
279
|
-
cmdbs: %i[test_cmdb
|
|
280
|
-
|
|
281
|
-
for_nodes(
|
|
278
|
+
cmdbs: %i[test_cmdb test_cmdb_2],
|
|
279
|
+
additional_config: <<~'EO_CONFIG'
|
|
280
|
+
for_nodes('node1') do
|
|
282
281
|
master_cmdbs(
|
|
283
|
-
test_cmdb: :
|
|
284
|
-
|
|
282
|
+
test_cmdb: :different_comment_2,
|
|
283
|
+
test_cmdb_2: :different_comment
|
|
285
284
|
)
|
|
286
285
|
end
|
|
287
|
-
for_nodes(
|
|
286
|
+
for_nodes('node2') do
|
|
288
287
|
master_cmdbs(
|
|
289
288
|
test_cmdb: :different_comment,
|
|
290
|
-
|
|
289
|
+
test_cmdb_2: :different_comment_2
|
|
291
290
|
)
|
|
292
291
|
end
|
|
293
|
-
|
|
292
|
+
EO_CONFIG
|
|
294
293
|
) do
|
|
295
|
-
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from
|
|
294
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb_2'
|
|
296
295
|
expect(test_nodes_handler.get_different_comment_of('node2')).to eq 'Comment from test_cmdb'
|
|
297
|
-
expect(test_nodes_handler.
|
|
298
|
-
expect(test_nodes_handler.
|
|
296
|
+
expect(test_nodes_handler.get_different_comment_2_of('node1')).to eq 'Comment2 from test_cmdb'
|
|
297
|
+
expect(test_nodes_handler.get_different_comment_2_of('node2')).to eq 'Comment2 from test_cmdb_2'
|
|
299
298
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
300
299
|
[:get_different_comment, %w[node2], {}],
|
|
301
|
-
[:
|
|
300
|
+
[:get_different_comment_2, %w[node1], { 'node1' => { different_comment: 'Comment from test_cmdb_2' } }]
|
|
302
301
|
]
|
|
303
|
-
expect(cmdb(:
|
|
302
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
304
303
|
[:get_different_comment, %w[node1], {}],
|
|
305
|
-
[:
|
|
304
|
+
[:get_different_comment_2, %w[node2], { 'node2' => { different_comment: 'Comment from test_cmdb' } }]
|
|
306
305
|
]
|
|
307
306
|
end
|
|
308
307
|
end
|
|
309
308
|
|
|
310
309
|
it 'fails when there are conflicts in the definition of master CMDBs' do
|
|
311
310
|
with_cmdb_test_platform(
|
|
312
|
-
cmdbs: %i[test_cmdb
|
|
313
|
-
|
|
311
|
+
cmdbs: %i[test_cmdb test_cmdb_2],
|
|
312
|
+
additional_config: <<~'EO_CONFIG'
|
|
314
313
|
master_cmdbs(
|
|
315
|
-
test_cmdb: %i[different_comment
|
|
314
|
+
test_cmdb: %i[different_comment different_comment_2]
|
|
316
315
|
)
|
|
317
316
|
master_cmdbs(
|
|
318
317
|
test_cmdb: :different_comment,
|
|
319
|
-
|
|
318
|
+
test_cmdb_2: :different_comment_2
|
|
320
319
|
)
|
|
321
|
-
|
|
320
|
+
EO_CONFIG
|
|
322
321
|
) do
|
|
323
|
-
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error 'Property
|
|
322
|
+
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error 'Property different_comment_2 have conflicting CMDB masters for node1 declared in the configuration: HybridPlatformsConductorTest::CmdbPlugins::TestCmdb and HybridPlatformsConductorTest::CmdbPlugins::TestCmdb2'
|
|
324
323
|
end
|
|
325
324
|
end
|
|
326
325
|
|
|
327
326
|
it 'fails when the CMDB marked as master does not implement the property' do
|
|
328
327
|
with_cmdb_test_platform(
|
|
329
|
-
cmdbs: %i[test_cmdb
|
|
330
|
-
|
|
328
|
+
cmdbs: %i[test_cmdb test_cmdb_2],
|
|
329
|
+
additional_config: <<~'EO_CONFIG'
|
|
331
330
|
master_cmdbs(
|
|
332
|
-
|
|
331
|
+
test_cmdb_2: :upcase
|
|
333
332
|
)
|
|
334
|
-
|
|
333
|
+
EO_CONFIG
|
|
335
334
|
) do
|
|
336
|
-
expect { test_nodes_handler.get_upcase_of('node1') }.to raise_error 'CMDB
|
|
335
|
+
expect { test_nodes_handler.get_upcase_of('node1') }.to raise_error 'CMDB test_cmdb_2 is configured as a master for property upcase on node node1 but it does not implement the needed API to retrieve it'
|
|
337
336
|
end
|
|
338
337
|
end
|
|
339
338
|
|
|
340
339
|
it 'continues trying different CMDBs to get a property even if ones already gives it' do
|
|
341
|
-
with_cmdb_test_platform(cmdbs: %i[
|
|
340
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb_2 test_cmdb]) do
|
|
342
341
|
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has nothing'
|
|
343
342
|
# test_cmdb was not even called, as it was registered second
|
|
344
343
|
expect(cmdb(:test_cmdb).calls).to eq [
|
|
345
344
|
[:get_nothing, ['node1'], {}]
|
|
346
345
|
]
|
|
347
|
-
expect(cmdb(:
|
|
346
|
+
expect(cmdb(:test_cmdb_2).calls).to eq [
|
|
348
347
|
[:get_nothing, ['node1'], {}]
|
|
349
348
|
]
|
|
350
349
|
end
|
|
@@ -7,15 +7,15 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'initializes with a platform having no node' do
|
|
10
|
-
with_test_platform do
|
|
10
|
+
with_test_platform({}) do
|
|
11
11
|
expect(test_nodes_handler.known_nodes).to eq []
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it 'iterates over defined nodes sequentially' do
|
|
16
|
-
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
|
16
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} } }) do
|
|
17
17
|
nodes_iterated = []
|
|
18
|
-
test_nodes_handler.for_each_node_in([
|
|
18
|
+
test_nodes_handler.for_each_node_in(%w[node2 node3 node4]) do |node|
|
|
19
19
|
nodes_iterated << node
|
|
20
20
|
end
|
|
21
21
|
expect(nodes_iterated.sort).to eq %w[node2 node3 node4].sort
|
|
@@ -23,18 +23,15 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it 'iterates over defined nodes in parallel' do
|
|
26
|
-
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
|
26
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} } }) do
|
|
27
27
|
nodes_iterated = []
|
|
28
|
-
test_nodes_handler.for_each_node_in([
|
|
28
|
+
test_nodes_handler.for_each_node_in(%w[node2 node3 node4], parallel: true) do |node|
|
|
29
29
|
sleep(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
when 'node4'
|
|
36
|
-
1
|
|
37
|
-
end
|
|
30
|
+
{
|
|
31
|
+
'node2' => 2,
|
|
32
|
+
'node3' => 3,
|
|
33
|
+
'node4' => 1
|
|
34
|
+
}[node]
|
|
38
35
|
)
|
|
39
36
|
nodes_iterated << node
|
|
40
37
|
end
|
|
@@ -43,12 +40,12 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
43
40
|
end
|
|
44
41
|
|
|
45
42
|
it 'iterates over defined nodes in parallel and handle errors correctly' do
|
|
46
|
-
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
|
43
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} } }) do
|
|
47
44
|
nodes_iterated = []
|
|
48
45
|
# Make sure we exit the test case even if the error is not handled correctly by using a timeout
|
|
49
46
|
Timeout.timeout(5) do
|
|
50
47
|
expect do
|
|
51
|
-
test_nodes_handler.for_each_node_in([
|
|
48
|
+
test_nodes_handler.for_each_node_in(%w[node2 node3 node4], parallel: true) do |node|
|
|
52
49
|
case node
|
|
53
50
|
when 'node2'
|
|
54
51
|
sleep 2
|
|
@@ -68,27 +65,34 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
68
65
|
|
|
69
66
|
it 'selects the correct configurations for a given node' do
|
|
70
67
|
with_test_platform(
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
{
|
|
69
|
+
nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} },
|
|
70
|
+
nodes_lists: { 'nodeslist1' => %w[node1 node2], 'nodeslist2' => %w[node3 node4] }
|
|
71
|
+
}
|
|
73
72
|
) do
|
|
74
|
-
expect(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
expect(
|
|
74
|
+
test_nodes_handler.select_confs_for_node(
|
|
75
|
+
'node2',
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
conf: 'conf1',
|
|
79
|
+
nodes_selectors_stack: ['/node1/']
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
conf: 'conf2',
|
|
83
|
+
nodes_selectors_stack: ['/node2/']
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
conf: 'conf3',
|
|
87
|
+
nodes_selectors_stack: [[{ list: 'nodeslist1' }]]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
conf: 'conf4',
|
|
91
|
+
nodes_selectors_stack: [[{ list: 'nodeslist2' }]]
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
).map { |config| config[:conf] }.sort
|
|
95
|
+
).to eq %w[
|
|
92
96
|
conf2
|
|
93
97
|
conf3
|
|
94
98
|
].sort
|
|
@@ -97,59 +101,65 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
97
101
|
|
|
98
102
|
it 'selects the correct configurations for a given platform' do
|
|
99
103
|
with_test_platforms(
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
{
|
|
105
|
+
'platform1' => { nodes: { 'node11' => {}, 'node12' => {}, 'node13' => {}, 'node14' => {} } },
|
|
106
|
+
'platform2' => { nodes: { 'node21' => {}, 'node22' => {}, 'node23' => {}, 'node24' => {} } }
|
|
107
|
+
}
|
|
102
108
|
) do
|
|
103
|
-
expect(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
expect(
|
|
110
|
+
test_nodes_handler.select_confs_for_platform(
|
|
111
|
+
'platform2',
|
|
112
|
+
[
|
|
113
|
+
{
|
|
114
|
+
conf: 'conf1',
|
|
115
|
+
nodes_selectors_stack: ['/node1/']
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
conf: 'conf2',
|
|
119
|
+
nodes_selectors_stack: ['/node2/']
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
conf: 'conf3',
|
|
123
|
+
nodes_selectors_stack: [%w[node11 node13 node21 node22 node23 node24]]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
conf: 'conf4',
|
|
127
|
+
nodes_selectors_stack: [%w[node11 node13 node21 node22 node24]]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
).map { |config| config[:conf] }.sort
|
|
131
|
+
).to eq %w[
|
|
121
132
|
conf2
|
|
122
133
|
conf3
|
|
123
134
|
].sort
|
|
124
135
|
end
|
|
125
136
|
end
|
|
126
137
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
expect(test_nodes_handler.sudo_on('node3', 'test_user')).to eq 'sudo -u test_user'
|
|
152
|
-
end
|
|
138
|
+
it 'computes the correct sudo for different nodes' do
|
|
139
|
+
with_test_platform(
|
|
140
|
+
{
|
|
141
|
+
nodes: {
|
|
142
|
+
'node1' => {},
|
|
143
|
+
'node2' => {},
|
|
144
|
+
'node3' => {}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
additional_config: <<~'EO_CONFIG'
|
|
148
|
+
for_nodes(%w[node1 node2]) do
|
|
149
|
+
sudo_for { |user| "alt_sudo1 -p #{user}" }
|
|
150
|
+
end
|
|
151
|
+
for_nodes('node2') do
|
|
152
|
+
sudo_for { |user| "alt_sudo2 -q #{user}" }
|
|
153
|
+
end
|
|
154
|
+
EO_CONFIG
|
|
155
|
+
) do
|
|
156
|
+
expect(test_nodes_handler.sudo_on('node1')).to eq 'alt_sudo1 -p root'
|
|
157
|
+
expect(test_nodes_handler.sudo_on('node1', 'test_user')).to eq 'alt_sudo1 -p test_user'
|
|
158
|
+
expect(test_nodes_handler.sudo_on('node2')).to eq 'alt_sudo2 -q root'
|
|
159
|
+
expect(test_nodes_handler.sudo_on('node2', 'test_user')).to eq 'alt_sudo2 -q test_user'
|
|
160
|
+
expect(test_nodes_handler.sudo_on('node3')).to eq 'sudo -u root'
|
|
161
|
+
expect(test_nodes_handler.sudo_on('node3', 'test_user')).to eq 'sudo -u test_user'
|
|
153
162
|
end
|
|
163
|
+
end
|
|
154
164
|
|
|
155
165
|
end
|