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
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb
ADDED
@@ -0,0 +1,313 @@
|
|
1
|
+
describe HybridPlatformsConductor::ActionsExecutor do
|
2
|
+
|
3
|
+
context 'checking connector plugin ssh' do
|
4
|
+
|
5
|
+
context 'checking additional helpers' do
|
6
|
+
|
7
|
+
# Return the connector to be tested
|
8
|
+
#
|
9
|
+
# Result::
|
10
|
+
# * Connector: Connector to be tested
|
11
|
+
def test_connector
|
12
|
+
test_actions_executor.connector(:ssh)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get the SSH config for a given node.
|
16
|
+
# Don't return comments and empty lines.
|
17
|
+
#
|
18
|
+
# Parameters::
|
19
|
+
# * *node* (String or nil): The node we look the SSH config for, or nil for the global configuration
|
20
|
+
# * *ssh_config* (String or nil): The SSH config, or nil to get it from the test_actions_executor [default: nil]
|
21
|
+
# * *nodes* (Array<String> or nil): List of nodes to give ssh_config, or nil for none. Used only if ssh_config is nil. [default: nil]
|
22
|
+
# * *ssh_exec* (String or nil): SSH executable, or nil to keep default. Used only if ssh_config is nil. [default: nil]
|
23
|
+
# * *known_hosts_file* (String or nil): Known host file to give. Used only if ssh_config is nil. [default: nil]
|
24
|
+
# Result::
|
25
|
+
# * String or nil: Corresponding SSH config, or nil if none
|
26
|
+
def ssh_config_for(node, ssh_config: nil, nodes: nil, ssh_exec: nil, known_hosts_file: nil)
|
27
|
+
if ssh_config.nil?
|
28
|
+
params = {}
|
29
|
+
params[:nodes] = nodes unless nodes.nil?
|
30
|
+
params[:ssh_exec] = ssh_exec unless ssh_exec.nil?
|
31
|
+
params[:known_hosts_file] = known_hosts_file unless known_hosts_file.nil?
|
32
|
+
ssh_config = test_connector.ssh_config(**params)
|
33
|
+
end
|
34
|
+
ssh_config_lines = ssh_config.split("\n")
|
35
|
+
begin_marker = node.nil? ? /^Host \*$/ : /^# #{Regexp.escape(node)} - .+$/
|
36
|
+
start_idx = ssh_config_lines.index { |line| line =~ begin_marker }
|
37
|
+
return nil if start_idx.nil?
|
38
|
+
end_marker = /^# \w+ - .+$/
|
39
|
+
end_idx = ssh_config_lines[start_idx + 1..-1].index { |line| line =~ end_marker }
|
40
|
+
end_idx = end_idx.nil? ? -1 : start_idx + end_idx
|
41
|
+
ssh_config_lines[start_idx..end_idx].select do |line|
|
42
|
+
stripped_line = line.strip
|
43
|
+
!stripped_line.empty? && stripped_line[0] != '#'
|
44
|
+
end.join("\n") + "\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'generates a global configuration with user from environment' do
|
48
|
+
with_test_platform do
|
49
|
+
ENV['hpc_ssh_user'] = 'test_user'
|
50
|
+
expect(ssh_config_for(nil)).to eq <<~EOS
|
51
|
+
Host *
|
52
|
+
User test_user
|
53
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_actions_executor_mux_%h_%p_%r
|
54
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
55
|
+
EOS
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'generates a global configuration with user from setting' do
|
60
|
+
with_test_platform do
|
61
|
+
test_connector.ssh_user = 'test_user'
|
62
|
+
expect(ssh_config_for(nil)).to eq <<~EOS
|
63
|
+
Host *
|
64
|
+
User test_user
|
65
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_actions_executor_mux_%h_%p_%r
|
66
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
67
|
+
EOS
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'generates a global configuration with known hosts file' do
|
72
|
+
with_test_platform do
|
73
|
+
test_connector.ssh_user = 'test_user'
|
74
|
+
expect(ssh_config_for(nil, known_hosts_file: '/path/to/known_hosts')).to eq <<~EOS
|
75
|
+
Host *
|
76
|
+
User test_user
|
77
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_actions_executor_mux_%h_%p_%r
|
78
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
79
|
+
UserKnownHostsFile /path/to/known_hosts
|
80
|
+
EOS
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'generates a global configuration without strict host key checking' do
|
85
|
+
with_test_platform do
|
86
|
+
test_connector.ssh_user = 'test_user'
|
87
|
+
test_connector.ssh_strict_host_key_checking = false
|
88
|
+
expect(ssh_config_for(nil)).to eq <<~EOS
|
89
|
+
Host *
|
90
|
+
User test_user
|
91
|
+
ControlPath #{Dir.tmpdir}/hpc_ssh/hpc_actions_executor_mux_%h_%p_%r
|
92
|
+
PubkeyAcceptedKeyTypes +ssh-dss
|
93
|
+
StrictHostKeyChecking no
|
94
|
+
EOS
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'includes the gateway definition from environment' do
|
99
|
+
with_test_platform({}, false, 'gateway :gateway1, \'Host my_gateway\'') do
|
100
|
+
ENV['hpc_ssh_gateways_conf'] = 'gateway1'
|
101
|
+
expect(test_connector.ssh_config).to match /^Host my_gateway$/
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'includes the gateway definition from setting' do
|
106
|
+
with_test_platform({}, false, 'gateway :gateway1, \'Host my_gateway\'') do
|
107
|
+
test_connector.ssh_gateways_conf = :gateway1
|
108
|
+
expect(test_connector.ssh_config).to match /^Host my_gateway$/
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'includes the gateway definition with a different ssh executable' do
|
113
|
+
with_test_platform({}, false, 'gateway :gateway1, \'Host my_gateway_<%= @ssh_exec %>\'') do
|
114
|
+
test_connector.ssh_gateways_conf = :gateway1
|
115
|
+
expect(test_connector.ssh_config(ssh_exec: 'new_ssh')).to match /^Host my_gateway_new_ssh$/
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'does not include the gateway definition if it is not selected' do
|
120
|
+
with_test_platform({}, false, 'gateway :gateway2, \'Host my_gateway\'') do
|
121
|
+
test_connector.ssh_gateways_conf = :gateway1
|
122
|
+
expect(test_connector.ssh_config).not_to match /^Host my_gateway$/
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'generates a simple config for a node with host_ip' do
|
127
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }) do
|
128
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
129
|
+
Host hpc.node
|
130
|
+
Hostname 192.168.42.42
|
131
|
+
EOS
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'generates a simple config for several nodes' do
|
136
|
+
with_test_platform(nodes: {
|
137
|
+
'node1' => { meta: { host_ip: '192.168.42.1' } },
|
138
|
+
'node2' => { meta: { host_ip: '192.168.42.2' } },
|
139
|
+
'node3' => { meta: { host_ip: '192.168.42.3' } }
|
140
|
+
}) do
|
141
|
+
expect(ssh_config_for('node1')).to eq <<~EOS
|
142
|
+
Host hpc.node1
|
143
|
+
Hostname 192.168.42.1
|
144
|
+
EOS
|
145
|
+
expect(ssh_config_for('node2')).to eq <<~EOS
|
146
|
+
Host hpc.node2
|
147
|
+
Hostname 192.168.42.2
|
148
|
+
EOS
|
149
|
+
expect(ssh_config_for('node3')).to eq <<~EOS
|
150
|
+
Host hpc.node3
|
151
|
+
Hostname 192.168.42.3
|
152
|
+
EOS
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'selects nodes when generating the config' do
|
157
|
+
with_test_platform(nodes: {
|
158
|
+
'node1' => { meta: { host_ip: '192.168.42.1' } },
|
159
|
+
'node2' => { meta: { host_ip: '192.168.42.2' } },
|
160
|
+
'node3' => { meta: { host_ip: '192.168.42.3' } }
|
161
|
+
}) do
|
162
|
+
expect(ssh_config_for('node1', nodes: %w[node1 node3])).to eq <<~EOS
|
163
|
+
Host hpc.node1
|
164
|
+
Hostname 192.168.42.1
|
165
|
+
EOS
|
166
|
+
expect(ssh_config_for('node2', nodes: %w[node1 node3])).to eq nil
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'fails if a node can\'t be connected to' do
|
171
|
+
with_test_platform(nodes: { 'node' => {} }) do
|
172
|
+
expect { ssh_config_for('node') }.to raise_error(/No connection possible to node/)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'generates an alias if the node has a hostname' do
|
177
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', hostname: 'my_hostname.my_domain' } } }) do
|
178
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
179
|
+
Host hpc.node my_hostname.my_domain
|
180
|
+
Hostname 192.168.42.42
|
181
|
+
EOS
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'generates aliases if the node has private ips' do
|
186
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', private_ips: ['192.168.42.1', '192.168.42.2'] } } }) do
|
187
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
188
|
+
Host hpc.node hpc.192.168.42.1 hpc.192.168.42.2
|
189
|
+
Hostname 192.168.42.42
|
190
|
+
EOS
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'generates a simple config for a node with hostname' do
|
195
|
+
with_test_platform(nodes: { 'node' => { meta: { hostname: 'my_hostname.my_domain' } } }) do
|
196
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
197
|
+
Host hpc.node my_hostname.my_domain
|
198
|
+
Hostname my_hostname.my_domain
|
199
|
+
EOS
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'generates a simple config for a node with private_ips' do
|
204
|
+
with_test_platform(nodes: { 'node' => { meta: { private_ips: ['192.168.42.1', '192.168.42.2'] } } }) do
|
205
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
206
|
+
Host hpc.node hpc.192.168.42.1 hpc.192.168.42.2
|
207
|
+
Hostname 192.168.42.1
|
208
|
+
EOS
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'uses node forced gateway information' do
|
213
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', gateway: 'test_gateway', gateway_user: 'test_gateway_user' } } }) do
|
214
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
215
|
+
Host hpc.node
|
216
|
+
Hostname 192.168.42.42
|
217
|
+
ProxyCommand ssh -q -W %h:%p test_gateway_user@test_gateway
|
218
|
+
EOS
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'uses node default gateway information and user from environment' do
|
223
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', gateway: 'test_gateway' } } }) do
|
224
|
+
ENV['hpc_ssh_gateway_user'] = 'test_gateway_user'
|
225
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
226
|
+
Host hpc.node
|
227
|
+
Hostname 192.168.42.42
|
228
|
+
ProxyCommand ssh -q -W %h:%p test_gateway_user@test_gateway
|
229
|
+
EOS
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'uses node default gateway information and user from setting' do
|
234
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', gateway: 'test_gateway' } } }) do
|
235
|
+
test_connector.ssh_gateway_user = 'test_gateway_user'
|
236
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
237
|
+
Host hpc.node
|
238
|
+
Hostname 192.168.42.42
|
239
|
+
ProxyCommand ssh -q -W %h:%p test_gateway_user@test_gateway
|
240
|
+
EOS
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
it 'uses node forced gateway information with a different ssh executable' do
|
245
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', gateway: 'test_gateway', gateway_user: 'test_gateway_user' } } }) do
|
246
|
+
expect(ssh_config_for('node', ssh_exec: 'new_ssh')).to eq <<~EOS
|
247
|
+
Host hpc.node
|
248
|
+
Hostname 192.168.42.42
|
249
|
+
ProxyCommand new_ssh -q -W %h:%p test_gateway_user@test_gateway
|
250
|
+
EOS
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'uses node default gateway information with a different ssh executable' do
|
255
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42', gateway: 'test_gateway' } } }) do
|
256
|
+
test_connector.ssh_gateway_user = 'test_gateway_user'
|
257
|
+
expect(ssh_config_for('node', ssh_exec: 'new_ssh')).to eq <<~EOS
|
258
|
+
Host hpc.node
|
259
|
+
Hostname 192.168.42.42
|
260
|
+
ProxyCommand new_ssh -q -W %h:%p test_gateway_user@test_gateway
|
261
|
+
EOS
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'generates a config compatible for passwords authentication' do
|
266
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }) do
|
267
|
+
test_connector.passwords['node'] = 'PaSsWoRd'
|
268
|
+
expect(ssh_config_for('node')).to eq <<~EOS
|
269
|
+
Host hpc.node
|
270
|
+
Hostname 192.168.42.42
|
271
|
+
PreferredAuthentications password
|
272
|
+
PubkeyAuthentication no
|
273
|
+
EOS
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'generates a config compatible for passwords authentication only for marked nodes' do
|
278
|
+
with_test_platform(nodes: {
|
279
|
+
'node1' => { meta: { host_ip: '192.168.42.1' } },
|
280
|
+
'node2' => { meta: { host_ip: '192.168.42.2' } },
|
281
|
+
'node3' => { meta: { host_ip: '192.168.42.3' } },
|
282
|
+
'node4' => { meta: { host_ip: '192.168.42.4' } }
|
283
|
+
}) do
|
284
|
+
test_connector.passwords['node1'] = 'PaSsWoRd1'
|
285
|
+
test_connector.passwords['node3'] = 'PaSsWoRd3'
|
286
|
+
expect(ssh_config_for('node1')).to eq <<~EOS
|
287
|
+
Host hpc.node1
|
288
|
+
Hostname 192.168.42.1
|
289
|
+
PreferredAuthentications password
|
290
|
+
PubkeyAuthentication no
|
291
|
+
EOS
|
292
|
+
expect(ssh_config_for('node2')).to eq <<~EOS
|
293
|
+
Host hpc.node2
|
294
|
+
Hostname 192.168.42.2
|
295
|
+
EOS
|
296
|
+
expect(ssh_config_for('node3')).to eq <<~EOS
|
297
|
+
Host hpc.node3
|
298
|
+
Hostname 192.168.42.3
|
299
|
+
PreferredAuthentications password
|
300
|
+
PubkeyAuthentication no
|
301
|
+
EOS
|
302
|
+
expect(ssh_config_for('node4')).to eq <<~EOS
|
303
|
+
Host hpc.node4
|
304
|
+
Hostname 192.168.42.4
|
305
|
+
EOS
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
describe HybridPlatformsConductor::ActionsExecutor do
|
2
|
+
|
3
|
+
context 'checking connector plugin ssh' do
|
4
|
+
|
5
|
+
context 'checking additional helpers on prepared nodes' do
|
6
|
+
|
7
|
+
it 'provides an SSH executable wrapping the node\'s SSH config' do
|
8
|
+
with_test_platform_for_remote_testing do
|
9
|
+
expect(`#{test_connector.ssh_exec} -V 2>&1`).to eq `ssh -V 2>&1`
|
10
|
+
expect(`#{test_connector.ssh_exec} -G hpc.node`.split("\n").find { |line| line =~ /^hostname .+$/ }).to eq 'hostname 192.168.42.42'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'provides an SSH URL that can be used by other processes to connect to this node' do
|
15
|
+
with_test_platform_for_remote_testing do
|
16
|
+
expect(test_connector.ssh_url).to eq 'test_user@hpc.node'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'uses sshpass in the provided SSH executable if needed' do
|
21
|
+
with_test_platform_for_remote_testing(password: 'PaSsWoRd') do
|
22
|
+
expect(`#{test_connector.ssh_exec} -V 2>&1`).to eq `ssh -V 2>&1`
|
23
|
+
expect(`#{test_connector.ssh_exec} -G hpc.node`.split("\n").find { |line| line =~ /^hostname .+$/ }).to eq 'hostname 192.168.42.42'
|
24
|
+
expect(File.read(test_connector.ssh_exec)).to match /^sshpass -pPaSsWoRd ssh .+$/
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
describe HybridPlatformsConductor::ActionsExecutor do
|
2
|
+
|
3
|
+
context 'checking connector plugin ssh' do
|
4
|
+
|
5
|
+
context 'checking remote actions' do
|
6
|
+
|
7
|
+
it 'executes bash commands remotely' do
|
8
|
+
with_test_platform_for_remote_testing(
|
9
|
+
expected_cmds: [[/.+\/ssh test_user@hpc\.node \/bin\/bash <<'EOF'\nbash_cmd.bash\nEOF/, proc { [0, 'Bash commands executed on node', ''] }]],
|
10
|
+
expected_stdout: 'Bash commands executed on node'
|
11
|
+
) do
|
12
|
+
test_connector.remote_bash('bash_cmd.bash')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'executes bash commands remotely with timeout' do
|
17
|
+
with_test_platform_for_remote_testing(
|
18
|
+
expected_cmds: [
|
19
|
+
[
|
20
|
+
/.+\/ssh test_user@hpc\.node \/bin\/bash <<'EOF'\nbash_cmd.bash\nEOF/,
|
21
|
+
proc do |cmd, log_to_file: nil, log_to_stdout: true, log_stdout_to_io: nil, log_stderr_to_io: nil, expected_code: 0, timeout: nil, no_exception: false|
|
22
|
+
expect(timeout).to eq 5
|
23
|
+
[0, '', '']
|
24
|
+
end
|
25
|
+
]
|
26
|
+
],
|
27
|
+
timeout: 5
|
28
|
+
) do
|
29
|
+
test_connector.remote_bash('bash_cmd.bash')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'executes interactive commands remotely' do
|
34
|
+
with_test_platform_for_remote_testing do
|
35
|
+
expect(test_connector).to receive(:system) do |cmd|
|
36
|
+
expect(cmd).to match /^.+\/ssh test_user@hpc\.node$/
|
37
|
+
end
|
38
|
+
test_connector.remote_interactive
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'copies files remotely' do
|
43
|
+
with_test_platform_for_remote_testing(
|
44
|
+
expected_cmds: [
|
45
|
+
[
|
46
|
+
/cd \/path\/to && tar\s+--create\s+--gzip\s+--file -\s+src.file \| \/.+\/ssh\s+test_user@hpc\.node\s+"tar\s+--extract\s+--gunzip\s+--file -\s+--directory \/remote_path\/to\/dst.dir\s+--owner root\s+"/,
|
47
|
+
proc { [0, '', ''] }
|
48
|
+
]
|
49
|
+
]
|
50
|
+
) do
|
51
|
+
test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'copies files remotely with timeout' do
|
56
|
+
with_test_platform_for_remote_testing(
|
57
|
+
expected_cmds: [
|
58
|
+
[
|
59
|
+
/cd \/path\/to && tar\s+--create\s+--gzip\s+--file -\s+src.file \| \/.+\/ssh\s+test_user@hpc\.node\s+"tar\s+--extract\s+--gunzip\s+--file -\s+--directory \/remote_path\/to\/dst.dir\s+--owner root\s+"/,
|
60
|
+
proc do |cmd, log_to_file: nil, log_to_stdout: true, log_stdout_to_io: nil, log_stderr_to_io: nil, expected_code: 0, timeout: nil, no_exception: false|
|
61
|
+
expect(timeout).to eq 5
|
62
|
+
[0, '', '']
|
63
|
+
end
|
64
|
+
]
|
65
|
+
],
|
66
|
+
timeout: 5
|
67
|
+
) do
|
68
|
+
test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'executes really big bash commands remotely' do
|
73
|
+
cmd = "echo #{'1' * 131_060}"
|
74
|
+
with_test_platform_for_remote_testing(
|
75
|
+
expected_cmds: [
|
76
|
+
[
|
77
|
+
/.+\/hpc_temp_cmds_.+\.sh$/,
|
78
|
+
proc do |received_cmd|
|
79
|
+
expect(File.read(received_cmd)).to match /.+\/ssh test_user@hpc\.node \/bin\/bash <<'EOF'\n#{Regexp.escape(cmd)}\nEOF/
|
80
|
+
[0, 'Bash commands executed on node', '']
|
81
|
+
end
|
82
|
+
]
|
83
|
+
],
|
84
|
+
expected_stdout: 'Bash commands executed on node'
|
85
|
+
) do
|
86
|
+
# Use an argument that exceeds the max arg length limit
|
87
|
+
test_connector.remote_bash(cmd)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'copies files remotely with sudo' do
|
92
|
+
with_test_platform_for_remote_testing(
|
93
|
+
expected_cmds: [
|
94
|
+
[
|
95
|
+
/cd \/path\/to && tar\s+--create\s+--gzip\s+--file -\s+src.file \| \/.+\/ssh\s+test_user@hpc\.node\s+"sudo tar\s+--extract\s+--gunzip\s+--file -\s+--directory \/remote_path\/to\/dst.dir\s+--owner root\s+"/,
|
96
|
+
proc { [0, '', ''] }
|
97
|
+
]
|
98
|
+
]
|
99
|
+
) do
|
100
|
+
test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir', sudo: true)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'copies files remotely with a different owner' do
|
105
|
+
with_test_platform_for_remote_testing(
|
106
|
+
expected_cmds: [
|
107
|
+
[
|
108
|
+
/cd \/path\/to && tar\s+--create\s+--gzip\s+--file -\s+--owner remote_user\s+src.file \| \/.+\/ssh\s+test_user@hpc\.node\s+"tar\s+--extract\s+--gunzip\s+--file -\s+--directory \/remote_path\/to\/dst.dir\s+--owner root\s+"/,
|
109
|
+
proc { [0, '', ''] }
|
110
|
+
]
|
111
|
+
]
|
112
|
+
) do
|
113
|
+
test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir', owner: 'remote_user')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'copies files remotely with a different group' do
|
118
|
+
with_test_platform_for_remote_testing(
|
119
|
+
expected_cmds: [
|
120
|
+
[
|
121
|
+
/cd \/path\/to && tar\s+--create\s+--gzip\s+--file -\s+--group remote_group\s+src.file \| \/.+\/ssh\s+test_user@hpc\.node\s+"tar\s+--extract\s+--gunzip\s+--file -\s+--directory \/remote_path\/to\/dst.dir\s+--owner root\s+"/,
|
122
|
+
proc { [0, '', ''] }
|
123
|
+
]
|
124
|
+
]
|
125
|
+
) do
|
126
|
+
test_connector.remote_copy('/path/to/src.file', '/remote_path/to/dst.dir', group: 'remote_group')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|