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
|
@@ -97,7 +97,7 @@ class ProxmoxWaiter
|
|
|
97
97
|
clean_up_done = false
|
|
98
98
|
# Check if we can remove some expired ones
|
|
99
99
|
@config['pve_nodes'].each do |pve_node|
|
|
100
|
-
if api_get("nodes/#{pve_node}/lxc").any? { |lxc_info|
|
|
100
|
+
if api_get("nodes/#{pve_node}/lxc").any? { |lxc_info| vm_expired?(pve_node, Integer(lxc_info['vmid'])) }
|
|
101
101
|
destroy_expired_vms_on(pve_node)
|
|
102
102
|
clean_up_done = true
|
|
103
103
|
end
|
|
@@ -131,7 +131,7 @@ class ProxmoxWaiter
|
|
|
131
131
|
# Select the best node, first keeping expired VMs if possible.
|
|
132
132
|
# This is the index of the scores to be checked: if we can choose without recycling VMs, do it by considering score index 0.
|
|
133
133
|
score_idx =
|
|
134
|
-
if pve_node_scores.all? { |_pve_node,
|
|
134
|
+
if pve_node_scores.all? { |_pve_node, itr_pve_node_scores| itr_pve_node_scores[0].nil? }
|
|
135
135
|
# No node was available without removing expired VMs.
|
|
136
136
|
# Therefore we consider only scores without expired VMs.
|
|
137
137
|
log 'No PVE node has enough free resources without removing eventual expired VMs'
|
|
@@ -139,12 +139,12 @@ class ProxmoxWaiter
|
|
|
139
139
|
else
|
|
140
140
|
0
|
|
141
141
|
end
|
|
142
|
-
selected_pve_node, selected_pve_node_score = pve_node_scores.inject([nil, nil]) do |(best_pve_node, best_score), (pve_node,
|
|
143
|
-
if
|
|
144
|
-
|
|
142
|
+
selected_pve_node, selected_pve_node_score = pve_node_scores.inject([nil, nil]) do |(best_pve_node, best_score), (pve_node, itr_pve_node_scores)|
|
|
143
|
+
if itr_pve_node_scores[score_idx].nil? ||
|
|
144
|
+
(!best_score.nil? && itr_pve_node_scores[score_idx] >= best_score)
|
|
145
145
|
[best_pve_node, best_score]
|
|
146
146
|
else
|
|
147
|
-
[pve_node,
|
|
147
|
+
[pve_node, itr_pve_node_scores[score_idx]]
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
150
|
if selected_pve_node.nil?
|
|
@@ -201,26 +201,24 @@ class ProxmoxWaiter
|
|
|
201
201
|
vm_id_str = vm_info['vm_id'].to_s
|
|
202
202
|
# Destroy the VM ID
|
|
203
203
|
# Find which PVE node hosts this VM
|
|
204
|
-
unless @config['pve_nodes'].any? do |pve_node|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
else
|
|
215
|
-
log "[ #{pve_node}/#{vm_info['vm_id']} ] - This container is not hosting the node/environment to be destroyed: #{metadata[:node]}/#{metadata[:environment]} != #{vm_info['node']}/#{vm_info['environment']}"
|
|
216
|
-
false
|
|
217
|
-
end
|
|
204
|
+
log "Could not find any PVE node hosting VM #{vm_info['vm_id']}" unless @config['pve_nodes'].any? do |pve_node|
|
|
205
|
+
api_get("nodes/#{pve_node}/lxc").any? do |lxc_info|
|
|
206
|
+
if lxc_info['vmid'] == vm_id_str
|
|
207
|
+
# Make sure this VM is still used for the node and environment we want.
|
|
208
|
+
# It could have been deleted manually and re-affected to another node/environment automatically, and in this case we should not remove it.
|
|
209
|
+
metadata = vm_metadata(pve_node, vm_info['vm_id'])
|
|
210
|
+
if metadata[:node] == vm_info['node'] && metadata[:environment] == vm_info['environment']
|
|
211
|
+
destroy_vm_on(pve_node, vm_info['vm_id'])
|
|
212
|
+
found_pve_node = pve_node
|
|
213
|
+
true
|
|
218
214
|
else
|
|
215
|
+
log "[ #{pve_node}/#{vm_info['vm_id']} ] - This container is not hosting the node/environment to be destroyed: #{metadata[:node]}/#{metadata[:environment]} != #{vm_info['node']}/#{vm_info['environment']}"
|
|
219
216
|
false
|
|
220
217
|
end
|
|
218
|
+
else
|
|
219
|
+
false
|
|
221
220
|
end
|
|
222
221
|
end
|
|
223
|
-
log "Could not find any PVE node hosting VM #{vm_info['vm_id']}"
|
|
224
222
|
end
|
|
225
223
|
end
|
|
226
224
|
reserved_resource = {}
|
|
@@ -286,10 +284,10 @@ class ProxmoxWaiter
|
|
|
286
284
|
# We disappeared from the queue!
|
|
287
285
|
log '[ Futex queue ] - !!! Somebody removed use from the queue. Add our PID back.'
|
|
288
286
|
write_access_queue(queue_futex_file, access_queue + [pid])
|
|
289
|
-
elsif idx
|
|
287
|
+
elsif idx.zero?
|
|
290
288
|
# Access granted
|
|
291
289
|
log '[ Futex queue ] - Exclusive access granted'
|
|
292
|
-
write_access_queue(queue_futex_file, access_queue[1
|
|
290
|
+
write_access_queue(queue_futex_file, access_queue[1..])
|
|
293
291
|
retry_futex_queue = false
|
|
294
292
|
else
|
|
295
293
|
# Just check that the first PID still exists, otherwise remove it from the queue.
|
|
@@ -304,7 +302,7 @@ class ProxmoxWaiter
|
|
|
304
302
|
end
|
|
305
303
|
unless first_pid_exist
|
|
306
304
|
log "[ Futex queue ] - !!! First PID #{first_pid} does not exist - remove it from the queue"
|
|
307
|
-
write_access_queue(queue_futex_file, access_queue[1
|
|
305
|
+
write_access_queue(queue_futex_file, access_queue[1..])
|
|
308
306
|
end
|
|
309
307
|
end
|
|
310
308
|
end
|
|
@@ -343,7 +341,7 @@ class ProxmoxWaiter
|
|
|
343
341
|
# Get the list of PVE nodes by default
|
|
344
342
|
@config['pve_nodes'] = nodes_info.map { |node_info| node_info['node'] } unless @config['pve_nodes']
|
|
345
343
|
rescue
|
|
346
|
-
raise "Unable to connect to Proxmox API #{@config['proxmox_api_url']} with user #{@proxmox_user}: #{
|
|
344
|
+
raise "Unable to connect to Proxmox API #{@config['proxmox_api_url']} with user #{@proxmox_user}: #{$ERROR_INFO}"
|
|
347
345
|
end
|
|
348
346
|
@expiration_date = Time.now.utc - @config['expiration_period_secs']
|
|
349
347
|
log "Consider expiration date #{@expiration_date.strftime('%F %T')}"
|
|
@@ -372,8 +370,8 @@ class ProxmoxWaiter
|
|
|
372
370
|
# * *disk_gb* (Integer): Wanted GB of disk
|
|
373
371
|
# Result::
|
|
374
372
|
# * Hash<String, [Float or nil, Float or nil]>: The set of 2 scores, per PVE node name
|
|
375
|
-
def pve_scores_for(
|
|
376
|
-
|
|
373
|
+
def pve_scores_for(_nbr_cpus, ram_mb, disk_gb)
|
|
374
|
+
@config['pve_nodes'].map do |pve_node|
|
|
377
375
|
# Get some resource usages stats from the node directly
|
|
378
376
|
status_info = api_get("nodes/#{pve_node}/status")
|
|
379
377
|
load_average = status_info['loadavg'].map { |load_str| Float(load_str) }
|
|
@@ -393,13 +391,13 @@ class ProxmoxWaiter
|
|
|
393
391
|
# Store the resources used by containers we can recycle in separate variables.
|
|
394
392
|
expired_disk_gb_used = 0
|
|
395
393
|
expired_ram_mb_used = 0
|
|
396
|
-
|
|
394
|
+
api_get("nodes/#{pve_node}/lxc").each do |lxc_info|
|
|
397
395
|
vm_id = Integer(lxc_info['vmid'])
|
|
398
396
|
# Some times the Proxmox API returns maxdisk as a String (but not always) even if it is documented as Integer here: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc.
|
|
399
397
|
# TODO: Remove the Integer conversion when Proxmox API will be fixed.
|
|
400
398
|
lxc_disk_gb_used = Integer(lxc_info['maxdisk']) / (1024 * 1024 * 1024)
|
|
401
399
|
lxc_ram_mb_used = lxc_info['maxmem'] / (1024 * 1024)
|
|
402
|
-
if
|
|
400
|
+
if vm_expired?(pve_node, vm_id)
|
|
403
401
|
expired_disk_gb_used += lxc_disk_gb_used
|
|
404
402
|
expired_ram_mb_used += lxc_ram_mb_used
|
|
405
403
|
else
|
|
@@ -419,16 +417,12 @@ class ProxmoxWaiter
|
|
|
419
417
|
# Otherwise, store the scores, taking into account coefficients to then choose among possible PVE nodes.
|
|
420
418
|
[
|
|
421
419
|
if expected_ram_percent_used <= @config['limits']['ram_percent_used_max'] &&
|
|
422
|
-
|
|
420
|
+
expected_disk_percent_used <= @config['limits']['disk_percent_used_max']
|
|
423
421
|
expected_ram_percent_used * @config['coeff_ram_consumption'] + expected_disk_percent_used * @config['coeff_disk_consumption']
|
|
424
|
-
else
|
|
425
|
-
nil
|
|
426
422
|
end,
|
|
427
423
|
if expected_ram_percent_used_without_expired <= @config['limits']['ram_percent_used_max'] &&
|
|
428
|
-
|
|
424
|
+
expected_disk_percent_used_without_expired <= @config['limits']['disk_percent_used_max']
|
|
429
425
|
expected_ram_percent_used_without_expired * @config['coeff_ram_consumption'] + expected_disk_percent_used_without_expired * @config['coeff_disk_consumption']
|
|
430
|
-
else
|
|
431
|
-
nil
|
|
432
426
|
end
|
|
433
427
|
]
|
|
434
428
|
else
|
|
@@ -437,7 +431,7 @@ class ProxmoxWaiter
|
|
|
437
431
|
[nil, nil]
|
|
438
432
|
end
|
|
439
433
|
]
|
|
440
|
-
end
|
|
434
|
+
end.to_h
|
|
441
435
|
end
|
|
442
436
|
|
|
443
437
|
# Is a given VM expired?
|
|
@@ -447,7 +441,7 @@ class ProxmoxWaiter
|
|
|
447
441
|
# * *vm_id* (Integer): The VM ID
|
|
448
442
|
# Result::
|
|
449
443
|
# * Boolean: Is the given VM expired?
|
|
450
|
-
def
|
|
444
|
+
def vm_expired?(pve_node, vm_id)
|
|
451
445
|
if vm_id.between?(*@config['vm_ids_range'])
|
|
452
446
|
# Get its reservation date from the notes
|
|
453
447
|
metadata = vm_metadata(pve_node, vm_id)
|
|
@@ -505,10 +499,10 @@ class ProxmoxWaiter
|
|
|
505
499
|
if hpc_marker_idx.nil?
|
|
506
500
|
{}
|
|
507
501
|
else
|
|
508
|
-
|
|
502
|
+
vm_description_lines[hpc_marker_idx + 1..].map do |line|
|
|
509
503
|
property, value = line.split(': ')
|
|
510
504
|
[property.to_sym, value]
|
|
511
|
-
end
|
|
505
|
+
end.to_h
|
|
512
506
|
end
|
|
513
507
|
end
|
|
514
508
|
|
|
@@ -536,7 +530,7 @@ class ProxmoxWaiter
|
|
|
536
530
|
# Possible error codes returned are:
|
|
537
531
|
# * *no_available_ip*: There is no available IP to be reserved
|
|
538
532
|
# * *no_available_vm_id*: There is no available VM ID to be reserved
|
|
539
|
-
def reserve_on(pve_node,
|
|
533
|
+
def reserve_on(pve_node, _nbr_cpus, _ram_mb, _disk_gb)
|
|
540
534
|
# We select a new VM ID and VM IP.
|
|
541
535
|
selected_vm_ip = free_ips.first
|
|
542
536
|
if selected_vm_ip.nil?
|
|
@@ -563,10 +557,10 @@ class ProxmoxWaiter
|
|
|
563
557
|
def destroy_expired_vms_on(pve_node)
|
|
564
558
|
api_get("nodes/#{pve_node}/lxc").each do |lxc_info|
|
|
565
559
|
vm_id = Integer(lxc_info['vmid'])
|
|
566
|
-
destroy_vm_on(pve_node, vm_id) if
|
|
560
|
+
destroy_vm_on(pve_node, vm_id) if vm_expired?(pve_node, vm_id)
|
|
567
561
|
end
|
|
568
562
|
# Invalidate the API cache for anything related to this PVE node
|
|
569
|
-
pve_node_paths_regexp =
|
|
563
|
+
pve_node_paths_regexp = %r{^nodes/#{Regexp.escape(pve_node)}/.+$}
|
|
570
564
|
@gets_cache.delete_if { |path, _result| path =~ pve_node_paths_regexp }
|
|
571
565
|
end
|
|
572
566
|
|
|
@@ -643,6 +637,7 @@ class ProxmoxWaiter
|
|
|
643
637
|
# * *task* (String): The task ID
|
|
644
638
|
def wait_for_proxmox_task(pve_node, task)
|
|
645
639
|
raise "Invalid task: #{task}" if task[0..3] == 'NOK:'
|
|
640
|
+
|
|
646
641
|
while task_status(pve_node, task) == 'running'
|
|
647
642
|
log "[ #{pve_node} ] - Wait for Proxmox task #{task} to complete..."
|
|
648
643
|
sleep 1
|
|
@@ -670,13 +665,14 @@ class ProxmoxWaiter
|
|
|
670
665
|
# * *path* (String): API path to query
|
|
671
666
|
# Result::
|
|
672
667
|
# * Object: The API response
|
|
673
|
-
def api_get(path
|
|
668
|
+
def api_get(path)
|
|
674
669
|
unless @gets_cache.key?(path)
|
|
675
670
|
idx_try = 0
|
|
676
671
|
loop do
|
|
677
672
|
@gets_cache[path] = @proxmox.get(path)
|
|
678
673
|
break unless @gets_cache[path].is_a?(String) && @gets_cache[path] =~ /^NOK: error code = 5\d\d$/
|
|
679
674
|
raise "Proxmox API get #{path} returns #{@gets_cache[path]} continuously (tried #{idx_try + 1} times)" if idx_try >= @config['api_max_retries']
|
|
675
|
+
|
|
680
676
|
idx_try += 1
|
|
681
677
|
# We have to reauthenticate: error 500 raised by Proxmox are often due to token being invalidated wrongly
|
|
682
678
|
# TODO: Provide a way to do it properly in the official gem
|
data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container
CHANGED
|
@@ -39,7 +39,6 @@ require 'json'
|
|
|
39
39
|
reserved_resource = nil
|
|
40
40
|
|
|
41
41
|
begin
|
|
42
|
-
|
|
43
42
|
# As this script is meant to be run in an SSH session, make sure we automatically flush stdout/stderr.
|
|
44
43
|
# Otherwise it will wait for the script completion before dumping everything, which is annoying as we want to track when it waits for hours.
|
|
45
44
|
$stdout.sync = true
|
|
@@ -59,7 +58,7 @@ begin
|
|
|
59
58
|
config_file = "#{__dir__}/config.json"
|
|
60
59
|
|
|
61
60
|
OptionParser.new do |opts|
|
|
62
|
-
opts.banner = "Usage: #{$
|
|
61
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
|
63
62
|
opts.on('-c', '--create FILE', 'Create a VM with the configuration stored in a given JSON file') do |file|
|
|
64
63
|
create_info = JSON.parse(File.read(file))
|
|
65
64
|
end
|
|
@@ -100,21 +99,18 @@ begin
|
|
|
100
99
|
puts "[ #{Time.now.utc.strftime('%F %T')} ] - Destroy #{destroy_info} (attempt ##{idx_retry}/#{max_retries})"
|
|
101
100
|
proxmox_waiter.destroy(destroy_info)
|
|
102
101
|
end
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
break
|
|
111
|
-
end
|
|
102
|
+
break unless reserved_resource.is_a?(Symbol)
|
|
103
|
+
|
|
104
|
+
# We got an error (missing resources, IPs...).
|
|
105
|
+
# Try again.
|
|
106
|
+
puts "Could not perform the operation because of error: #{reserved_resource}. Waiting #{wait_time_before_retry_secs} seconds before trying again."
|
|
107
|
+
reserved_resource = { error: reserved_resource }
|
|
108
|
+
sleep wait_time_before_retry_secs
|
|
112
109
|
idx_retry += 1
|
|
113
110
|
end
|
|
114
|
-
|
|
115
111
|
rescue
|
|
116
112
|
reserved_resource = {
|
|
117
|
-
error: "Unhandled exception from reserve_proxmox_container: #{
|
|
113
|
+
error: "Unhandled exception from reserve_proxmox_container: #{$ERROR_INFO}\n#{$ERROR_INFO.backtrace.join("\n")}"
|
|
118
114
|
}
|
|
119
115
|
end
|
|
120
116
|
|
|
@@ -12,7 +12,7 @@ module HybridPlatformsConductor
|
|
|
12
12
|
# Export in the Mediawiki format
|
|
13
13
|
class Confluence < HybridPlatformsConductor::Report
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
extend_config_dsl_with CommonConfigDsl::Confluence, :init_confluence
|
|
16
16
|
|
|
17
17
|
# Give the list of supported locales by this report generator
|
|
18
18
|
# [API] - This method is mandatory.
|
|
@@ -29,7 +29,7 @@ module HybridPlatformsConductor
|
|
|
29
29
|
# Parameters::
|
|
30
30
|
# * *nodes* (Array<String>): List of nodes
|
|
31
31
|
# * *locale_code* (Symbol): The locale code
|
|
32
|
-
def report_for(nodes,
|
|
32
|
+
def report_for(nodes, _locale_code)
|
|
33
33
|
confluence_info = @config.confluence_info
|
|
34
34
|
if confluence_info
|
|
35
35
|
if confluence_info[:inventory_report_page_id]
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
require 'hybrid_platforms_conductor/report'
|
|
2
2
|
require 'time'
|
|
3
3
|
|
|
4
|
+
# We use true/false as symbols on purpose for translations
|
|
5
|
+
# rubocop:disable Lint/BooleanSymbol
|
|
6
|
+
|
|
4
7
|
module HybridPlatformsConductor
|
|
5
8
|
|
|
6
9
|
module HpcPlugins
|
|
@@ -71,12 +74,12 @@ module HybridPlatformsConductor
|
|
|
71
74
|
output = ''
|
|
72
75
|
locale = TRANSLATIONS[locale_code]
|
|
73
76
|
|
|
74
|
-
output << <<~
|
|
77
|
+
output << <<~EO_MEDIAWIKI
|
|
75
78
|
Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
|
|
76
79
|
|
|
77
80
|
This page has been generated using <code>./bin/report --format mediawiki</code> on #{Time.now.utc.strftime('%F %T')} UTC.
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
EO_MEDIAWIKI
|
|
80
83
|
|
|
81
84
|
# Get all confs
|
|
82
85
|
# Use the translations' keys to know all properties we want to display
|
|
@@ -84,7 +87,7 @@ module HybridPlatformsConductor
|
|
|
84
87
|
@nodes_handler.prefetch_metadata_of nodes, locale.keys
|
|
85
88
|
nodes.
|
|
86
89
|
map do |node|
|
|
87
|
-
{ node: node }.merge(
|
|
90
|
+
{ node: node }.merge(all_properties.map { |property| [property, @nodes_handler.metadata_of(node, property)] }.to_h)
|
|
88
91
|
end.
|
|
89
92
|
# Group them by physical / VMs
|
|
90
93
|
group_by do |node_info|
|
|
@@ -116,22 +119,24 @@ module HybridPlatformsConductor
|
|
|
116
119
|
output << "* '''#{node_info.delete(:node)}'''#{node_info[:private_ips].nil? || node_info[:private_ips].empty? ? '' : " - #{node_info[:private_ips].first}"} - #{node_info.delete(:description)}\n"
|
|
117
120
|
node_info.delete(:private_ips) if !node_info[:private_ips].nil? && node_info[:private_ips].size == 1
|
|
118
121
|
node_info.sort.each do |property, value|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
next if value.nil?
|
|
123
|
+
|
|
124
|
+
raise "Missing translation of key: #{property}. Please edit TRANSLATIONS[:#{locale_code}]." unless locale.key?(property)
|
|
125
|
+
|
|
126
|
+
output << ": #{locale[property]}: #{
|
|
127
|
+
case value
|
|
128
|
+
when Array
|
|
129
|
+
"\n#{value.map { |item| "::* #{item}" }.join("\n")}"
|
|
130
|
+
when Hash
|
|
131
|
+
"\n#{value.map { |item, item_value| "::* #{item}: #{item_value}" }.join("\n")}"
|
|
132
|
+
when TrueClass
|
|
133
|
+
locale[:true]
|
|
134
|
+
when FalseClass
|
|
135
|
+
locale[:false]
|
|
136
|
+
else
|
|
137
|
+
value.to_str
|
|
138
|
+
end
|
|
139
|
+
}\n"
|
|
135
140
|
end
|
|
136
141
|
output << "\n\n"
|
|
137
142
|
end
|
|
@@ -139,7 +144,7 @@ module HybridPlatformsConductor
|
|
|
139
144
|
end
|
|
140
145
|
end
|
|
141
146
|
|
|
142
|
-
output << <<~
|
|
147
|
+
output << <<~EO_MEDIAWIKI
|
|
143
148
|
Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages
|
|
144
149
|
|
|
145
150
|
[[Category:My Project]]
|
|
@@ -150,7 +155,7 @@ module HybridPlatformsConductor
|
|
|
150
155
|
[[Category:Server]]
|
|
151
156
|
[[Category:Configuration]]
|
|
152
157
|
[[Category:Chef]]
|
|
153
|
-
|
|
158
|
+
EO_MEDIAWIKI
|
|
154
159
|
|
|
155
160
|
out output
|
|
156
161
|
end
|
|
@@ -162,3 +167,5 @@ module HybridPlatformsConductor
|
|
|
162
167
|
end
|
|
163
168
|
|
|
164
169
|
end
|
|
170
|
+
|
|
171
|
+
# rubocop:enable Lint/BooleanSymbol
|
|
@@ -25,31 +25,35 @@ module HybridPlatformsConductor
|
|
|
25
25
|
# Parameters::
|
|
26
26
|
# * *nodes* (Array<String>): List of nodes
|
|
27
27
|
# * *locale_code* (Symbol): The locale code
|
|
28
|
-
def report_for(nodes,
|
|
28
|
+
def report_for(nodes, _locale_code)
|
|
29
29
|
@nodes_handler.prefetch_metadata_of nodes, %i[hostname host_ip physical image description services]
|
|
30
|
-
out(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
table << [
|
|
42
|
-
node,
|
|
43
|
-
@platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name,
|
|
44
|
-
@nodes_handler.get_hostname_of(node),
|
|
45
|
-
@nodes_handler.get_host_ip_of(node),
|
|
46
|
-
@nodes_handler.get_physical_of(node) ? 'Yes' : 'No',
|
|
47
|
-
@nodes_handler.get_image_of(node),
|
|
48
|
-
@nodes_handler.get_description_of(node),
|
|
49
|
-
(@nodes_handler.get_services_of(node) || []).sort.join(', ')
|
|
30
|
+
out(
|
|
31
|
+
Terminal::Table.new(
|
|
32
|
+
headings: [
|
|
33
|
+
'Node',
|
|
34
|
+
'Platform',
|
|
35
|
+
'Host name',
|
|
36
|
+
'IP',
|
|
37
|
+
'Physical?',
|
|
38
|
+
'OS',
|
|
39
|
+
'Description',
|
|
40
|
+
'Services'
|
|
50
41
|
]
|
|
42
|
+
) do |table|
|
|
43
|
+
nodes.sort.each do |node|
|
|
44
|
+
table << [
|
|
45
|
+
node,
|
|
46
|
+
@platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name,
|
|
47
|
+
@nodes_handler.get_hostname_of(node),
|
|
48
|
+
@nodes_handler.get_host_ip_of(node),
|
|
49
|
+
@nodes_handler.get_physical_of(node) ? 'Yes' : 'No',
|
|
50
|
+
@nodes_handler.get_image_of(node),
|
|
51
|
+
@nodes_handler.get_description_of(node),
|
|
52
|
+
(@nodes_handler.get_services_of(node) || []).sort.join(', ')
|
|
53
|
+
]
|
|
54
|
+
end
|
|
51
55
|
end
|
|
52
|
-
|
|
56
|
+
)
|
|
53
57
|
end
|
|
54
58
|
|
|
55
59
|
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'hybrid_platforms_conductor/secrets_reader'
|
|
2
|
+
|
|
3
|
+
module HybridPlatformsConductor
|
|
4
|
+
|
|
5
|
+
module HpcPlugins
|
|
6
|
+
|
|
7
|
+
module SecretsReader
|
|
8
|
+
|
|
9
|
+
# Get secrets from the command-line
|
|
10
|
+
class Cli < HybridPlatformsConductor::SecretsReader
|
|
11
|
+
|
|
12
|
+
# Constructor
|
|
13
|
+
#
|
|
14
|
+
# Parameters::
|
|
15
|
+
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
|
16
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
|
17
|
+
# * *config* (Config): Config to be used. [default: Config.new]
|
|
18
|
+
# * *cmd_runner* (CmdRunner): CmdRunner to be used. [default: CmdRunner.new]
|
|
19
|
+
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
|
20
|
+
def initialize(
|
|
21
|
+
logger: Logger.new($stdout),
|
|
22
|
+
logger_stderr: Logger.new($stderr),
|
|
23
|
+
config: Config.new,
|
|
24
|
+
cmd_runner: CmdRunner.new,
|
|
25
|
+
nodes_handler: NodesHandler.new
|
|
26
|
+
)
|
|
27
|
+
super
|
|
28
|
+
@secrets_files = []
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Complete an option parser with options meant to control this secrets reader
|
|
32
|
+
# [API] - This method is optional
|
|
33
|
+
#
|
|
34
|
+
# Parameters::
|
|
35
|
+
# * *options_parser* (OptionParser): The option parser to complete
|
|
36
|
+
def options_parse(options_parser)
|
|
37
|
+
options_parser.on('-e', '--secrets JSON_FILE', 'Specify a secrets location from a local JSON file. Can be specified several times.') do |file|
|
|
38
|
+
@secrets_files << file
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Return secrets for a given service to be deployed on a node.
|
|
43
|
+
# [API] - This method is mandatory
|
|
44
|
+
# [API] - The following API components are accessible:
|
|
45
|
+
# * *@config* (Config): Main configuration API.
|
|
46
|
+
# * *@cmd_runner* (CmdRunner): Command Runner API.
|
|
47
|
+
# * *@nodes_handler* (NodesHandler): Nodes handler API.
|
|
48
|
+
#
|
|
49
|
+
# Parameters::
|
|
50
|
+
# * *node* (String): Node to be deployed
|
|
51
|
+
# * *service* (String): Service to be deployed
|
|
52
|
+
# Result::
|
|
53
|
+
# * Hash: The secrets
|
|
54
|
+
def secrets_for(_node, _service)
|
|
55
|
+
# As we are dealing with global secrets, cache the reading for performance between nodes and services.
|
|
56
|
+
unless defined?(@secrets)
|
|
57
|
+
@secrets = {}
|
|
58
|
+
@secrets_files.each do |secrets_file|
|
|
59
|
+
raise "Missing secrets file: #{secrets_file}" unless File.exist?(secrets_file)
|
|
60
|
+
|
|
61
|
+
@secrets.merge!(JSON.parse(File.read(secrets_file))) do |key, value_1, value_2|
|
|
62
|
+
raise "Secret #{key} has conflicting values between different secret JSON files." if value_1 != value_2
|
|
63
|
+
|
|
64
|
+
value_1
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
@secrets
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|