hybrid_platforms_conductor 32.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
module HybridPlatformsConductor
|
2
|
+
|
3
|
+
module CommonConfigDsl
|
4
|
+
|
5
|
+
# Config DSL configuring idempotence testing (used by different test plugins)
|
6
|
+
module IdempotenceTests
|
7
|
+
|
8
|
+
# List of ignored tasks info. Each info has the following properties:
|
9
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
|
10
|
+
# * *ignored_tasks* (Hash<String, String>): List of task names for which we ignore idempotence errors, with the corresponding descriptive reason for ignore.
|
11
|
+
# Array< Hash<Symbol, Object> >
|
12
|
+
attr_reader :ignored_idempotence_tasks
|
13
|
+
|
14
|
+
# Initialize the DSL
|
15
|
+
def init_idempotence_tests
|
16
|
+
# List of ignored tasks info. Each info has the following properties:
|
17
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
|
18
|
+
# * *ignored_tasks* (Hash<String, String>): List of task names for which we ignore idempotence errors, with the corresponding descriptive reason for ignore.
|
19
|
+
# Array< Hash<Symbol, Object> >
|
20
|
+
@ignored_idempotence_tasks = []
|
21
|
+
end
|
22
|
+
|
23
|
+
# Ignore idempotence errors on a set of tasks
|
24
|
+
#
|
25
|
+
# Parameters::
|
26
|
+
# * *tasks_to_ignore* (Hash<String, String>): Set of tasks to ignore, along with the reason
|
27
|
+
def ignore_idempotence_tasks(tasks_to_ignore)
|
28
|
+
@ignored_idempotence_tasks << {
|
29
|
+
ignored_tasks: tasks_to_ignore,
|
30
|
+
nodes_selectors_stack: current_nodes_selectors_stack,
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
require 'cleanroom'
|
2
|
+
require 'git'
|
3
|
+
require 'ice_cube'
|
4
|
+
require 'hybrid_platforms_conductor/plugins'
|
5
|
+
|
6
|
+
module HybridPlatformsConductor
|
7
|
+
|
8
|
+
# Object used to access the whole configuration
|
9
|
+
class Config
|
10
|
+
|
11
|
+
include LoggerHelpers, Cleanroom
|
12
|
+
|
13
|
+
class << self
|
14
|
+
|
15
|
+
# Array<Symbol>: List of mixin initializers to call
|
16
|
+
attr_accessor :mixin_initializers
|
17
|
+
|
18
|
+
# Extend the config DSL used when parsing the hpc_config.rb file with a given Mixin.
|
19
|
+
# This can be used by any plugin to add plugin-specific configuration in the hpc_config.rb file.
|
20
|
+
#
|
21
|
+
# Parameters::
|
22
|
+
# * *mixin* (Module): Mixin to add to the Platforms DSL
|
23
|
+
# * *init_method* (Symbol or nil): The initializer method of this Mixin, or nil if none [default = nil]
|
24
|
+
def extend_config_dsl_with(mixin, init_method = nil)
|
25
|
+
include mixin
|
26
|
+
@mixin_initializers << init_method unless init_method.nil?
|
27
|
+
mixin.instance_methods.each do |method_name|
|
28
|
+
expose method_name unless method_name == init_method
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
@mixin_initializers = []
|
34
|
+
|
35
|
+
# Directory of the definition of the platforms
|
36
|
+
# String
|
37
|
+
attr_reader :hybrid_platforms_dir
|
38
|
+
expose :hybrid_platforms_dir
|
39
|
+
|
40
|
+
# List of expected failures info. Each info has the following properties:
|
41
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this expected failure
|
42
|
+
# * *tests* (Array<Symbol>): List of tests impacted by this expected failre
|
43
|
+
# * *reason* (String): Reason for this expected failure
|
44
|
+
# Array<Hash,Symbol,Object>
|
45
|
+
attr_reader :expected_failures
|
46
|
+
|
47
|
+
# List of retriable errors. Each info has the following properties:
|
48
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by those errors
|
49
|
+
# * *errors_on_stdout* (Array<String or Regexp>): List of errors match (as exact string match or using a regexp) to check against stdout
|
50
|
+
# * *errors_on_stderr* (Array<String or Regexp>): List of errors match (as exact string match or using a regexp) to check against stderr
|
51
|
+
attr_reader :retriable_errors
|
52
|
+
|
53
|
+
# List of deployment schedules. Each info has the following properties:
|
54
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
|
55
|
+
# * *schedule* (IceCube::Schedule): The deployment schedule
|
56
|
+
attr_reader :deployment_schedules
|
57
|
+
|
58
|
+
# Constructor
|
59
|
+
#
|
60
|
+
# Parameters::
|
61
|
+
# * *logger* (Logger): Logger to be used [default = Logger.new(STDOUT)]
|
62
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default = Logger.new(STDERR)]
|
63
|
+
def initialize(logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR))
|
64
|
+
init_loggers(logger, logger_stderr)
|
65
|
+
@hybrid_platforms_dir = File.expand_path(ENV['hpc_platforms'].nil? ? '.' : ENV['hpc_platforms'])
|
66
|
+
# Stack of the nodes selectors scopes
|
67
|
+
# Array< Object >
|
68
|
+
@nodes_selectors_stack = []
|
69
|
+
# List of OS image directories, per image name
|
70
|
+
# Hash<Symbol, String>
|
71
|
+
@os_images = {}
|
72
|
+
# Plugin ID of the tests provisioner
|
73
|
+
# Symbol
|
74
|
+
@tests_provisioner = :docker
|
75
|
+
# List of expected failures info. Each info has the following properties:
|
76
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this expected failure
|
77
|
+
# * *tests* (Array<Symbol>): List of tests impacted by this expected failre
|
78
|
+
# * *reason* (String): Reason for this expected failure
|
79
|
+
# Array<Hash,Symbol,Object>
|
80
|
+
@expected_failures = []
|
81
|
+
# List of retriable errors. Each info has the following properties:
|
82
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by those errors
|
83
|
+
# * *errors_on_stdout* (Array<String or Regexp>): List of errors match (as exact string match or using a regexp) to check against stdout
|
84
|
+
# * *errors_on_stderr* (Array<String or Regexp>): List of errors match (as exact string match or using a regexp) to check against stderr
|
85
|
+
@retriable_errors = []
|
86
|
+
# List of deployment schedules. Each info has the following properties:
|
87
|
+
# * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
|
88
|
+
# * *schedule* (IceCube::Schedule): The deployment schedule
|
89
|
+
@deployment_schedules = []
|
90
|
+
# Make sure plugins can decorate our DSL with their owns additions as well
|
91
|
+
# Therefore we parse all possible plugin types
|
92
|
+
Dir.glob("#{__dir__}/hpc_plugins/*").each do |plugin_dir|
|
93
|
+
Plugins.new(File.basename(plugin_dir).to_sym, logger: @logger, logger_stderr: @logger_stderr)
|
94
|
+
end
|
95
|
+
# Call initializers if needed
|
96
|
+
Config.mixin_initializers.each do |mixin_init_method|
|
97
|
+
self.send(mixin_init_method)
|
98
|
+
end
|
99
|
+
include_config_from "#{@hybrid_platforms_dir}/hpc_config.rb"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Include configuration from a DSL config file
|
103
|
+
#
|
104
|
+
# Parameters::
|
105
|
+
# * *dsl_file* (String): Path to the DSL file
|
106
|
+
def include_config_from(dsl_file)
|
107
|
+
log_debug "Include config from #{dsl_file}"
|
108
|
+
self.evaluate_file(dsl_file)
|
109
|
+
end
|
110
|
+
expose :include_config_from
|
111
|
+
|
112
|
+
# Register a new OS image
|
113
|
+
#
|
114
|
+
# Parameters::
|
115
|
+
# * *image* (Symbol): Name of the Docker image
|
116
|
+
# * *dir* (String): Directory containing the Dockerfile defining the image
|
117
|
+
def os_image(image, dir)
|
118
|
+
raise "OS image #{image} already defined to #{@os_images[image]}" if @os_images.key?(image)
|
119
|
+
@os_images[image] = dir
|
120
|
+
end
|
121
|
+
expose :os_image
|
122
|
+
|
123
|
+
# Set which provisioner should be used for tests
|
124
|
+
#
|
125
|
+
# Parameters::
|
126
|
+
# * *provisioner* (Symbol): Plugin ID of the provisioner to be used for tests
|
127
|
+
def tests_provisioner(provisioner)
|
128
|
+
@tests_provisioner = provisioner
|
129
|
+
end
|
130
|
+
expose :tests_provisioner
|
131
|
+
|
132
|
+
# Limit the scope of configuration to a given set of nodes
|
133
|
+
#
|
134
|
+
# Parameters::
|
135
|
+
# * *nodes_selectors* (Object): Nodes selectors, as defined by the NodesHandler#select_nodes method (check its signature for details)
|
136
|
+
# Proc: DSL code called in the context of those selected nodes
|
137
|
+
def for_nodes(nodes_selectors)
|
138
|
+
@nodes_selectors_stack << nodes_selectors
|
139
|
+
begin
|
140
|
+
yield
|
141
|
+
ensure
|
142
|
+
@nodes_selectors_stack.pop
|
143
|
+
end
|
144
|
+
end
|
145
|
+
expose :for_nodes
|
146
|
+
|
147
|
+
# Mark some tests as expected failures.
|
148
|
+
#
|
149
|
+
# Parameters::
|
150
|
+
# * *tests* (Symbol or Array<Symbol>): List of tests expected to fail.
|
151
|
+
# * *reason* (String): Descriptive reason for the failure
|
152
|
+
def expect_tests_to_fail(tests, reason)
|
153
|
+
@expected_failures << {
|
154
|
+
tests: tests.is_a?(Array) ? tests : [tests],
|
155
|
+
nodes_selectors_stack: current_nodes_selectors_stack,
|
156
|
+
reason: reason
|
157
|
+
}
|
158
|
+
end
|
159
|
+
expose :expect_tests_to_fail
|
160
|
+
|
161
|
+
# Mark some errors on stdout to be retriable during a deploy
|
162
|
+
#
|
163
|
+
# Parameters::
|
164
|
+
# * *errors* (String, Regexp or Array<String or Regexp>): Single (or list of) errors matching pattern (either as exact string match or using a regexp).
|
165
|
+
def retry_deploy_for_errors_on_stdout(errors)
|
166
|
+
@retriable_errors << {
|
167
|
+
errors_on_stdout: errors.is_a?(Array) ? errors : [errors],
|
168
|
+
nodes_selectors_stack: current_nodes_selectors_stack
|
169
|
+
}
|
170
|
+
end
|
171
|
+
expose :retry_deploy_for_errors_on_stdout
|
172
|
+
|
173
|
+
# Mark some errors on stderr to be retriable during a deploy
|
174
|
+
#
|
175
|
+
# Parameters::
|
176
|
+
# * *errors* (String, Regexp or Array<String or Regexp>): Single (or list of) errors matching pattern (either as exact string match or using a regexp).
|
177
|
+
def retry_deploy_for_errors_on_stderr(errors)
|
178
|
+
@retriable_errors << {
|
179
|
+
errors_on_stderr: errors.is_a?(Array) ? errors : [errors],
|
180
|
+
nodes_selectors_stack: current_nodes_selectors_stack
|
181
|
+
}
|
182
|
+
end
|
183
|
+
expose :retry_deploy_for_errors_on_stderr
|
184
|
+
|
185
|
+
# Set a deployment schedule
|
186
|
+
#
|
187
|
+
# Parameters::
|
188
|
+
# * *schedule* (IceCube::Schedule): The deployment schedule
|
189
|
+
def deployment_schedule(schedule)
|
190
|
+
@deployment_schedules << {
|
191
|
+
schedule: schedule,
|
192
|
+
nodes_selectors_stack: current_nodes_selectors_stack
|
193
|
+
}
|
194
|
+
end
|
195
|
+
expose :deployment_schedule
|
196
|
+
|
197
|
+
# Helper to get a daily schedule at a given time
|
198
|
+
#
|
199
|
+
# Parameters::
|
200
|
+
# * *time* (String): Time (UTC) for the daily schedule
|
201
|
+
# * *duration* (Integer): Number of seconds of duration [default: 3000]
|
202
|
+
# Result::
|
203
|
+
# * IceCube::Schedule: Corresponding schedule
|
204
|
+
def daily_at(time, duration: 3000)
|
205
|
+
IceCube::Schedule.new(Time.parse("2020-01-01 #{time} UTC"), duration: duration) do |s|
|
206
|
+
s.add_recurrence_rule(IceCube::Rule.daily)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
expose :daily_at
|
210
|
+
|
211
|
+
# Helper to get a weekly schedule at a given day and time
|
212
|
+
#
|
213
|
+
# Parameters::
|
214
|
+
# * *days* (Symbol or Array<Symbol>): Days for the weekly schedule (see IceCube::Rule documentation to know day names)
|
215
|
+
# * *time* (String): Time (UTC) for the weekly schedule
|
216
|
+
# * *duration* (Integer): Number of seconds of duration [default: 3000]
|
217
|
+
# Result::
|
218
|
+
# * IceCube::Schedule: Corresponding schedule
|
219
|
+
def weekly_at(days, time, duration: 3000)
|
220
|
+
days = [days] unless days.is_a?(Array)
|
221
|
+
IceCube::Schedule.new(Time.parse("2020-01-01 #{time} UTC"), duration: duration) do |s|
|
222
|
+
s.add_recurrence_rule(IceCube::Rule.weekly.day(*days))
|
223
|
+
end
|
224
|
+
end
|
225
|
+
expose :weekly_at
|
226
|
+
|
227
|
+
# Get the current nodes selector stack.
|
228
|
+
#
|
229
|
+
# Result::
|
230
|
+
# * Array<Object>: Nodes selectors stack
|
231
|
+
def current_nodes_selectors_stack
|
232
|
+
@nodes_selectors_stack.clone
|
233
|
+
end
|
234
|
+
|
235
|
+
# Get the list of known Docker images
|
236
|
+
#
|
237
|
+
# Result::
|
238
|
+
# * Array<Symbol>: List of known Docker images
|
239
|
+
def known_os_images
|
240
|
+
@os_images.keys
|
241
|
+
end
|
242
|
+
|
243
|
+
# Get the directory containing a Docker image
|
244
|
+
#
|
245
|
+
# Parameters::
|
246
|
+
# * *image* (Symbol): Image name
|
247
|
+
# Result::
|
248
|
+
# * String: Directory containing the Dockerfile of the image
|
249
|
+
def os_image_dir(image)
|
250
|
+
@os_images[image]
|
251
|
+
end
|
252
|
+
|
253
|
+
# Name of the provisioner to be used for tests
|
254
|
+
#
|
255
|
+
# Result::
|
256
|
+
# * Symbol: Provisioner to be used for tests
|
257
|
+
def tests_provisioner_id
|
258
|
+
@tests_provisioner
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/http'
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'uri'
|
5
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
6
|
+
require 'hybrid_platforms_conductor/credentials'
|
7
|
+
|
8
|
+
module HybridPlatformsConductor
|
9
|
+
|
10
|
+
# Object used to access Confluence API
|
11
|
+
class Confluence
|
12
|
+
|
13
|
+
include LoggerHelpers
|
14
|
+
|
15
|
+
# Provide a Confluence connector, and make sure the password is being cleaned when exiting.
|
16
|
+
#
|
17
|
+
# Parameters::
|
18
|
+
# * *confluence_url* (String): The Confluence URL
|
19
|
+
# * *logger* (Logger): Logger to be used
|
20
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr
|
21
|
+
# * Proc: Code called with the Confluence instance.
|
22
|
+
# * *confluence* (Confluence): The Confluence instance to use.
|
23
|
+
def self.with_confluence(confluence_url, logger, logger_stderr)
|
24
|
+
Credentials.with_credentials_for(:confluence, logger, logger_stderr, url: confluence_url) do |confluence_user, confluence_password|
|
25
|
+
yield Confluence.new(confluence_url, confluence_user, confluence_password, logger: logger, logger_stderr: logger_stderr)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Constructor
|
30
|
+
#
|
31
|
+
# Parameters::
|
32
|
+
# * *confluence_url* (String): The Confluence URL
|
33
|
+
# * *confluence_user_name* (String): Confluence user name to be used when querying the API
|
34
|
+
# * *confluence_password* (String): Confluence password to be used when querying the API
|
35
|
+
# * *logger* (Logger): Logger to be used [default = Logger.new(STDOUT)]
|
36
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default = Logger.new(STDERR)]
|
37
|
+
def initialize(confluence_url, confluence_user_name, confluence_password, logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR))
|
38
|
+
init_loggers(logger, logger_stderr)
|
39
|
+
@confluence_url = confluence_url
|
40
|
+
@confluence_user_name = confluence_user_name
|
41
|
+
@confluence_password = confluence_password
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return a Confluence storage format content from a page ID
|
45
|
+
#
|
46
|
+
# Parameters::
|
47
|
+
# * *page_id* (String): Confluence page ID
|
48
|
+
# Result::
|
49
|
+
# * Nokogiri::HTML: Storage format content, as a Nokogiri object
|
50
|
+
def page_storage_format(page_id)
|
51
|
+
Nokogiri::HTML(call_api("plugins/viewstorage/viewpagestorage.action?pageId=#{page_id}").body)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Return some info of a given page ID
|
55
|
+
#
|
56
|
+
# Parameters::
|
57
|
+
# * *page_id* (String): Confluence page ID
|
58
|
+
# Result::
|
59
|
+
# * Hash: Page information, as returned by the Confluence API
|
60
|
+
def page_info(page_id)
|
61
|
+
JSON.parse(call_api("rest/api/content/#{page_id}").body)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Update a Confluence page to a new content.
|
65
|
+
#
|
66
|
+
# Parameters::
|
67
|
+
# * *page_id* (String): Confluence page ID
|
68
|
+
# * *content* (String): New content
|
69
|
+
# * *version* (String or nil): New version, or nil to automatically increase last existing version [default: nil]
|
70
|
+
def update_page(page_id, content, version: nil)
|
71
|
+
info = page_info(page_id)
|
72
|
+
version = info['version']['number'] + 1 if version.nil?
|
73
|
+
log_debug "Update Confluence page #{page_id}..."
|
74
|
+
call_api("rest/api/content/#{page_id}", :put) do |request|
|
75
|
+
request['Content-Type'] = 'application/json'
|
76
|
+
request.body = {
|
77
|
+
type: 'page',
|
78
|
+
title: info['title'],
|
79
|
+
body: {
|
80
|
+
storage: {
|
81
|
+
value: content,
|
82
|
+
representation: 'storage'
|
83
|
+
}
|
84
|
+
},
|
85
|
+
version: { number: version }
|
86
|
+
}.to_json
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# Call the Confluence API for a given URL and HTTP verb.
|
93
|
+
# Provide a simple way to tweak the request with an optional proc.
|
94
|
+
# Automatically handles authentication, base URL and error handling.
|
95
|
+
#
|
96
|
+
# Parameters::
|
97
|
+
# * *api_path* (String): The API path to query
|
98
|
+
# * *http_method* (Symbol): HTTP method to be used to create the request [default = :get]
|
99
|
+
# * Proc: Optional code called to alter the request
|
100
|
+
# * Parameters::
|
101
|
+
# * *request* (Net::HTTPRequest): The request
|
102
|
+
# Result::
|
103
|
+
# * Net::HTTPResponse: The corresponding response
|
104
|
+
def call_api(api_path, http_method = :get)
|
105
|
+
response = nil
|
106
|
+
page_url = URI.parse("#{@confluence_url}/#{api_path}")
|
107
|
+
Net::HTTP.start(page_url.host, page_url.port, use_ssl: true) do |http|
|
108
|
+
request = Net::HTTP.const_get(http_method.to_s.capitalize.to_sym).new(page_url.request_uri)
|
109
|
+
request.basic_auth @confluence_user_name, @confluence_password
|
110
|
+
yield request if block_given?
|
111
|
+
response = http.request(request)
|
112
|
+
raise "Confluence page API request on #{page_url} returned an error: #{response.code}\n#{response.body}\n===== Request body =====\n#{request.body}" unless response.is_a?(Net::HTTPSuccess)
|
113
|
+
end
|
114
|
+
response
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
2
|
+
require 'hybrid_platforms_conductor/plugin'
|
3
|
+
|
4
|
+
module HybridPlatformsConductor
|
5
|
+
|
6
|
+
# Base class for any connector
|
7
|
+
class Connector < Plugin
|
8
|
+
|
9
|
+
# Constructor
|
10
|
+
#
|
11
|
+
# Parameters::
|
12
|
+
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
13
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
14
|
+
# * *config* (Config): Config to be used. [default: Config.new]
|
15
|
+
# * *cmd_runner* (CmdRunner): Command executor to be used. [default: CmdRunner.new]
|
16
|
+
# * *nodes_handler* (NodesHandler): NodesHandler to be used. [default: NodesHandler.new]
|
17
|
+
def initialize(
|
18
|
+
logger: Logger.new(STDOUT),
|
19
|
+
logger_stderr: Logger.new(STDERR),
|
20
|
+
config: Config.new,
|
21
|
+
cmd_runner: CmdRunner.new,
|
22
|
+
nodes_handler: NodesHandler.new
|
23
|
+
)
|
24
|
+
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
25
|
+
@cmd_runner = cmd_runner
|
26
|
+
@nodes_handler = nodes_handler
|
27
|
+
# If the connector has an initializer, use it
|
28
|
+
init if respond_to?(:init)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Prepare a connector to be run for a given node in a given context.
|
32
|
+
# It is required to call this method before using the following methods:
|
33
|
+
# * remote_bash
|
34
|
+
# * run_cmd
|
35
|
+
#
|
36
|
+
# Paramaters::
|
37
|
+
# * *node* (String): The node this connector is currently targeting
|
38
|
+
# * *timeout* (Integer or nil): Timeout this connector's process should have (in seconds), or nil if none
|
39
|
+
# * *stdout_io* (IO): IO to log stdout to
|
40
|
+
# * *stderr_io* (IO): IO to log stderr to
|
41
|
+
def prepare_for(node, timeout, stdout_io, stderr_io)
|
42
|
+
@node = node
|
43
|
+
@timeout = timeout
|
44
|
+
@stdout_io = stdout_io
|
45
|
+
@stderr_io = stderr_io
|
46
|
+
end
|
47
|
+
|
48
|
+
# Prepare connections to a given set of nodes.
|
49
|
+
# Useful to prefetch metadata or open bulk connections.
|
50
|
+
#
|
51
|
+
# Parameters::
|
52
|
+
# * *nodes* (Array<String>): Nodes to prepare the connection to
|
53
|
+
# * *no_exception* (Boolean): Should we still continue if some nodes have connection errors? [default: false]
|
54
|
+
# * Proc: Code called with the connections prepared.
|
55
|
+
# * Parameters::
|
56
|
+
# * *connected_nodes* (Array<String>): The list of connected nodes (should be equal to nodes unless no_exception == true and some nodes failed to connect)
|
57
|
+
def with_connection_to(nodes, no_exception: false)
|
58
|
+
yield nodes
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
# Run a command.
|
64
|
+
# Handle the redirection of standard output and standard error to file and stdout depending on the context of the run.
|
65
|
+
#
|
66
|
+
# Parameters::
|
67
|
+
# * *cmd* (String): The command to be run
|
68
|
+
# Result::
|
69
|
+
# * Integer: Exit code
|
70
|
+
# * String: Standard output
|
71
|
+
# * String: Error output
|
72
|
+
def run_cmd(cmd)
|
73
|
+
@cmd_runner.run_cmd(
|
74
|
+
cmd,
|
75
|
+
timeout: @timeout,
|
76
|
+
log_to_stdout: false,
|
77
|
+
log_stdout_to_io: @stdout_io,
|
78
|
+
log_stderr_to_io: @stderr_io
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|