hybrid_platforms_conductor 33.0.1 → 33.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -11
- data/lib/hybrid_platforms_conductor/config.rb +1 -0
- data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +116 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +8 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +28 -32
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +1 -1
- data/lib/hybrid_platforms_conductor/log.rb +3 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +2 -1
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +4 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +26 -20
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +39 -31
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +60 -42
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +11 -9
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +33 -21
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +91 -81
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +6 -4
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +6 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +1 -0
- metadata +136 -135
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8698bc386b9a607d4dda6b8a21ee754860b8027a26f851be1887ec8bbe3aaa96
|
4
|
+
data.tar.gz: ddb3c31da1f23113755fcfc07d97785b0ddc03611922568401043405e50014e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8076f914cd5675de3b990e78191569ba96c368c840644183c5a52f75feaa67f2b93172465595f8d6619c921c694ea16fb05eed18cc559b560f8dae7c5584fdf0
|
7
|
+
data.tar.gz: 42b83e310c9f03473e50c4b9694f3320126ebcbe30a4777845eecda87da4ccad78ffb7bcd99f4fb6b2e8b6f98f131052ae667389961602bb525e7e888fb71243
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
# [v33.1.1](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.1.0...v33.1.1) (2021-06-18 13:19:39)
|
2
|
+
|
3
|
+
### Patches
|
4
|
+
|
5
|
+
* [[Fix] Corrected bugs on log remote_fs plugin not working in dry-run and topographer](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/90dcde919b6fc99b8f79fc642fef8b4150a5a9d6)
|
6
|
+
|
7
|
+
# [v33.1.0](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.4...v33.1.0) (2021-06-18 11:37:28)
|
8
|
+
|
9
|
+
## Global changes
|
10
|
+
### Patches
|
11
|
+
|
12
|
+
* [[Feature(connector_local)] [#68] Add sudo support when copying files using the local connector](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/7725beca4429de0e81bcac0c0ac4fe149e625da2)
|
13
|
+
|
14
|
+
## Changes for connector_local
|
15
|
+
### Features
|
16
|
+
|
17
|
+
* [[Feature(connector_local)] [#68] Add sudo support when copying files using the local connector](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/7725beca4429de0e81bcac0c0ac4fe149e625da2)
|
18
|
+
|
19
|
+
# [v33.0.4](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.3...v33.0.4) (2021-06-18 10:09:57)
|
20
|
+
|
21
|
+
## Global changes
|
22
|
+
### Patches
|
23
|
+
|
24
|
+
* [[Fix(cmd_runner)] [#69] Make sure commands are run in unbundled env](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/0795c1ffdcf1b355c9dc91423bb6b7d88918fcf7)
|
25
|
+
|
26
|
+
## Changes for cmd_runner
|
27
|
+
### Patches
|
28
|
+
|
29
|
+
* [[Fix(cmd_runner)] [#69] Make sure commands are run in unbundled env](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/0795c1ffdcf1b355c9dc91423bb6b7d88918fcf7)
|
30
|
+
|
31
|
+
# [v33.0.3](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.2...v33.0.3) (2021-06-17 12:42:32)
|
32
|
+
|
33
|
+
### Patches
|
34
|
+
|
35
|
+
* [[#49] Corrected minor warnings and added tests that no warning occurs anymore in rspec](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/57e9936da05431ca469a98d7f079211d9278574f)
|
36
|
+
|
37
|
+
# [v33.0.2](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.1...v33.0.2) (2021-06-17 11:15:29)
|
38
|
+
|
39
|
+
### Patches
|
40
|
+
|
41
|
+
* [[#49] Corrected warnings to prepare migration to Ruby 3](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/8f3e758a881dcd988540d660b2df8a38fe39d1ca)
|
42
|
+
|
1
43
|
# [v33.0.1](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.0.0...v33.0.1) (2021-06-16 16:22:41)
|
2
44
|
|
3
45
|
### Patches
|
@@ -130,18 +130,20 @@ module HybridPlatformsConductor
|
|
130
130
|
(log_to_stdout ? [@logger_stderr] : []) +
|
131
131
|
(file_output.nil? ? [] : [file_output])
|
132
132
|
) do
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
133
|
+
Bundler.with_unbundled_env do
|
134
|
+
cmd_result = TTY::Command.new(
|
135
|
+
printer: :null,
|
136
|
+
pty: true,
|
137
|
+
timeout: timeout,
|
138
|
+
uuid: false
|
139
|
+
).run!(cmd) do |stdout, stderr|
|
140
|
+
stdout_queue << stdout if stdout
|
141
|
+
stderr_queue << stderr if stderr
|
142
|
+
end
|
143
|
+
exit_status = cmd_result.exit_status
|
144
|
+
cmd_stdout = cmd_result.out
|
145
|
+
cmd_stderr = cmd_result.err
|
141
146
|
end
|
142
|
-
exit_status = cmd_result.exit_status
|
143
|
-
cmd_stdout = cmd_result.out
|
144
|
-
cmd_stderr = cmd_result.err
|
145
147
|
end
|
146
148
|
rescue TTY::Command::TimeoutExceeded
|
147
149
|
exit_status = :timeout
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# This is a patch of cleanroom Rubygem v1.0.0 that adds kwargs support for Ruby 3.
|
2
|
+
# TODO: Remove this patch when the following code will be merged in a new version of cleanroom:
|
3
|
+
# https://github.com/sethvargo/cleanroom/compare/master...Muriel-Salvan:handle_kwargs?expand=1
|
4
|
+
|
5
|
+
module Cleanroom
|
6
|
+
|
7
|
+
# Add kwargs support
|
8
|
+
module ClassMethods
|
9
|
+
|
10
|
+
#
|
11
|
+
# Expose the given method to the DSL.
|
12
|
+
#
|
13
|
+
# @param [Symbol] name
|
14
|
+
#
|
15
|
+
def expose(name)
|
16
|
+
raise NameError, "undefined method `#{name}' for class `#{self.name}'" unless public_method_defined?(name)
|
17
|
+
|
18
|
+
exposed_methods_with_kwargs[name] = true if instance_method(name).parameters.any? { |(arg_type, _arg_name)| KWARGS_TYPES.include?(arg_type) }
|
19
|
+
exposed_methods[name] = true
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# Define the types of argument types that point kwargs arguments.
|
25
|
+
# Useful to treat them differently as when defining a method with kwargs, Ruby will pass parameters having a to_hash method differently to such methods:
|
26
|
+
#
|
27
|
+
# See this example illustrating the difference in treatment with and without kwargs in the method definition:
|
28
|
+
# def without_kwargs(*args)
|
29
|
+
# p args
|
30
|
+
# end
|
31
|
+
# def with_kwargs(*args, **kwargs)
|
32
|
+
# p args
|
33
|
+
# p kwargs
|
34
|
+
# end
|
35
|
+
# s_without_to_hash = 'Without to_hash'
|
36
|
+
# s_with_to_hash = 'With to_hash'
|
37
|
+
# s_with_to_hash.define_singleton_method(:to_hash) { { string: self.to_s } }
|
38
|
+
# without_kwargs(s_without_to_hash)
|
39
|
+
# ["Without to_hash"]
|
40
|
+
# without_kwargs(s_with_to_hash)
|
41
|
+
# ["With to_hash"]
|
42
|
+
# with_kwargs(s_without_to_hash)
|
43
|
+
# ["Without to_hash"]
|
44
|
+
# {}
|
45
|
+
# with_kwargs(s_with_to_hash)
|
46
|
+
# []
|
47
|
+
# {:string=>"With to_hash"}
|
48
|
+
KWARGS_TYPES = %i[key keyreq]
|
49
|
+
|
50
|
+
#
|
51
|
+
# The list of exposed methods with kwargs.
|
52
|
+
#
|
53
|
+
# @return [Hash]
|
54
|
+
#
|
55
|
+
def exposed_methods_with_kwargs
|
56
|
+
@exposed_methods_with_kwargs ||= from_superclass(:exposed_methods_with_kwargs, {}).dup
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# The cleanroom instance for this class. This method is intentionally
|
61
|
+
# NOT cached!
|
62
|
+
#
|
63
|
+
# @return [Class]
|
64
|
+
#
|
65
|
+
def cleanroom
|
66
|
+
exposed = exposed_methods.keys
|
67
|
+
exposed_with_kwargs = exposed_methods_with_kwargs.keys
|
68
|
+
parent = name || 'Anonymous'
|
69
|
+
|
70
|
+
Class.new(Object) do
|
71
|
+
class << self
|
72
|
+
|
73
|
+
def class_eval
|
74
|
+
raise Cleanroom::InaccessibleError.new(:class_eval, self)
|
75
|
+
end
|
76
|
+
|
77
|
+
def instance_eval
|
78
|
+
raise Cleanroom::InaccessibleError.new(:instance_eval, self)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
define_method(:initialize) do |instance|
|
84
|
+
define_singleton_method(:__instance__) do
|
85
|
+
raise Cleanroom::InaccessibleError.new(:__instance__, self) unless caller[0].include?(__FILE__)
|
86
|
+
|
87
|
+
instance
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
(exposed - exposed_with_kwargs).each do |exposed_method|
|
92
|
+
define_method(exposed_method) do |*args, &block|
|
93
|
+
__instance__.public_send(exposed_method, *args, &block)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
exposed_with_kwargs.each do |exposed_method|
|
98
|
+
define_method(exposed_method) do |*args, **kwargs, &block|
|
99
|
+
__instance__.public_send(exposed_method, *args, **kwargs, &block)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
define_method(:class_eval) do
|
104
|
+
raise Cleanroom::InaccessibleError.new(:class_eval, self)
|
105
|
+
end
|
106
|
+
|
107
|
+
define_method(:inspect) do
|
108
|
+
"#<#{parent} (Cleanroom)>"
|
109
|
+
end
|
110
|
+
alias_method :to_s, :inspect
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -5,7 +5,6 @@ require 'securerandom'
|
|
5
5
|
require 'time'
|
6
6
|
require 'hybrid_platforms_conductor/actions_executor'
|
7
7
|
require 'hybrid_platforms_conductor/cmd_runner'
|
8
|
-
require 'hybrid_platforms_conductor/executable'
|
9
8
|
require 'hybrid_platforms_conductor/logger_helpers'
|
10
9
|
require 'hybrid_platforms_conductor/nodes_handler'
|
11
10
|
require 'hybrid_platforms_conductor/services_handler'
|
@@ -147,6 +146,7 @@ module HybridPlatformsConductor
|
|
147
146
|
logger: @logger,
|
148
147
|
logger_stderr: @logger_stderr,
|
149
148
|
config: @config,
|
149
|
+
cmd_runner: @cmd_runner,
|
150
150
|
nodes_handler: @nodes_handler,
|
151
151
|
actions_executor: @actions_executor
|
152
152
|
)
|
@@ -50,7 +50,9 @@ module HybridPlatformsConductor
|
|
50
50
|
# [API] - @stdout_io can be used to send stdout output
|
51
51
|
# [API] - @stderr_io can be used to send stderr output
|
52
52
|
def remote_interactive
|
53
|
-
|
53
|
+
Bundler.with_unbundled_env do
|
54
|
+
system "cd #{workspace_for(@node)} ; /bin/bash"
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
58
|
# rubocop:disable Lint/UnusedMethodArgument
|
@@ -73,7 +75,11 @@ module HybridPlatformsConductor
|
|
73
75
|
def remote_copy(from, to, sudo: false, owner: nil, group: nil)
|
74
76
|
# If the destination is a relative path, prepend the workspace dir to it.
|
75
77
|
to = "#{workspace_for(@node)}/#{to}" unless to.start_with?('/')
|
76
|
-
|
78
|
+
if sudo
|
79
|
+
run_cmd "#{@nodes_handler.sudo_on(@node)} cp -r \"#{from}\" \"#{to}\""
|
80
|
+
else
|
81
|
+
FileUtils.cp_r from, to unless @cmd_runner.dry_run
|
82
|
+
end
|
77
83
|
end
|
78
84
|
# rubocop:enable Lint/UnusedMethodArgument
|
79
85
|
|
@@ -121,7 +121,9 @@ module HybridPlatformsConductor
|
|
121
121
|
# ...
|
122
122
|
# ===== STDERR =====
|
123
123
|
# ...
|
124
|
-
if
|
124
|
+
if @cmd_runner.dry_run
|
125
|
+
{ error: 'No log to show in dry-run mode' }
|
126
|
+
elsif exit_status.is_a?(Symbol)
|
125
127
|
{ error: "Error: #{exit_status}\n#{stderr}" }
|
126
128
|
else
|
127
129
|
stdout_lines = stdout.split("\n")
|
@@ -74,18 +74,16 @@ module HybridPlatformsConductor
|
|
74
74
|
# [API] - @cmd_runner is accessible.
|
75
75
|
def setup
|
76
76
|
required_version = YAML.load_file("#{@repository_path}/chef_versions.yml")['workstation']
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
@cmd_runner.run_cmd "curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}" unless existing_version == required_version
|
88
|
-
end
|
77
|
+
exit_status, stdout, _stderr = @cmd_runner.run_cmd '/opt/chef-workstation/bin/chef --version', expected_code: [0, :command_error]
|
78
|
+
existing_version =
|
79
|
+
if exit_status == :command_error
|
80
|
+
'not installed'
|
81
|
+
else
|
82
|
+
expected_match = stdout.match(/^Chef Workstation version: (.+)\.\d+$/)
|
83
|
+
expected_match.nil? ? 'unreadable' : expected_match[1]
|
84
|
+
end
|
85
|
+
log_debug "Current Chef version: #{existing_version}. Required version: #{required_version}"
|
86
|
+
@cmd_runner.run_cmd "curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}" unless existing_version == required_version
|
89
87
|
end
|
90
88
|
|
91
89
|
# Get the list of known nodes.
|
@@ -160,27 +158,25 @@ module HybridPlatformsConductor
|
|
160
158
|
current_package_info = File.exist?(package_info_file) ? JSON.parse(File.read(package_info_file)).transform_keys(&:to_sym) : {}
|
161
159
|
next if current_package_info == package_info
|
162
160
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
policy_file = local_policy_file
|
175
|
-
end
|
176
|
-
lock_file = "#{File.dirname(policy_file)}/#{File.basename(policy_file, '.rb')}.lock.json"
|
177
|
-
# If the policy lock file does not exist, generate it
|
178
|
-
@cmd_runner.run_cmd "cd #{@repository_path} && /opt/chef-workstation/bin/chef install #{policy_file} --chef-license accept" unless File.exist?("#{@repository_path}/#{lock_file}")
|
179
|
-
extra_cp_data_bags = File.exist?("#{@repository_path}/data_bags") ? " && cp -ar data_bags/ #{package_dir}/" : ''
|
180
|
-
@cmd_runner.run_cmd "cd #{@repository_path} && \
|
181
|
-
#{@cmd_runner.root? ? '' : 'sudo '}rm -rf #{package_dir} && \
|
182
|
-
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir} --chef-license accept#{extra_cp_data_bags}"
|
161
|
+
policy_file = "policyfiles/#{service}.rb"
|
162
|
+
if local_environment
|
163
|
+
local_policy_file = "policyfiles/#{service}.local.rb"
|
164
|
+
# In local mode, we always regenerate the lock file as we may modify the run list
|
165
|
+
run_list = known_cookbook_paths.any? { |cookbook_path| File.exist?("#{@repository_path}/#{cookbook_path}/hpc_test/recipes/before_run.rb") } ? ['hpc_test::before_run'] : []
|
166
|
+
dsl_parser = DslParser.new
|
167
|
+
dsl_parser.parse("#{@repository_path}/#{policy_file}")
|
168
|
+
run_list.concat dsl_parser.calls.find { |call_info| call_info[:method] == :run_list }[:args].flatten
|
169
|
+
run_list << 'hpc_test::after_run' if known_cookbook_paths.any? { |cookbook_path| File.exist?("#{@repository_path}/#{cookbook_path}/hpc_test/recipes/after_run.rb") }
|
170
|
+
File.write("#{@repository_path}/#{local_policy_file}", File.read("#{@repository_path}/#{policy_file}") + "\nrun_list #{run_list.map { |recipe| "'#{recipe}'" }.join(', ')}\n")
|
171
|
+
policy_file = local_policy_file
|
183
172
|
end
|
173
|
+
lock_file = "#{File.dirname(policy_file)}/#{File.basename(policy_file, '.rb')}.lock.json"
|
174
|
+
# If the policy lock file does not exist, generate it
|
175
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && /opt/chef-workstation/bin/chef install #{policy_file} --chef-license accept" unless File.exist?("#{@repository_path}/#{lock_file}")
|
176
|
+
extra_cp_data_bags = File.exist?("#{@repository_path}/data_bags") ? " && cp -ar data_bags/ #{package_dir}/" : ''
|
177
|
+
@cmd_runner.run_cmd "cd #{@repository_path} && \
|
178
|
+
#{@cmd_runner.root? ? '' : 'sudo '}rm -rf #{package_dir} && \
|
179
|
+
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir} --chef-license accept#{extra_cp_data_bags}"
|
184
180
|
next if @cmd_runner.dry_run
|
185
181
|
|
186
182
|
# Create secrets file
|
@@ -221,7 +221,7 @@ module HybridPlatformsConductor
|
|
221
221
|
# * *:exited*: The instance has run and is now stopped
|
222
222
|
# * *:error*: The instance is in error
|
223
223
|
def state
|
224
|
-
if @lxc_details.nil?
|
224
|
+
if !defined?(@lxc_details) || @lxc_details.nil?
|
225
225
|
:missing
|
226
226
|
else
|
227
227
|
status = nil
|
@@ -12,16 +12,19 @@ module HybridPlatformsConductor
|
|
12
12
|
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
13
13
|
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
14
14
|
# * *config* (Config): Config to be used. [default: Config.new]
|
15
|
+
# * *cmd_runner* (CmdRunner): CmdRunner to be used [default: CmdRunner.new]
|
15
16
|
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
16
17
|
# * *actions_executor* (ActionsExecutor): Actions executor to be used. [default: ActionsExecutor.new]
|
17
18
|
def initialize(
|
18
19
|
logger: Logger.new($stdout),
|
19
20
|
logger_stderr: Logger.new($stderr),
|
20
21
|
config: Config.new,
|
22
|
+
cmd_runner: CmdRunner.new,
|
21
23
|
nodes_handler: NodesHandler.new,
|
22
24
|
actions_executor: ActionsExecutor.new
|
23
25
|
)
|
24
26
|
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
27
|
+
@cmd_runner = cmd_runner
|
25
28
|
@nodes_handler = nodes_handler
|
26
29
|
@actions_executor = actions_executor
|
27
30
|
end
|
@@ -304,7 +304,8 @@ module HybridPlatformsConductor
|
|
304
304
|
|
305
305
|
# Define clusters of ips with 24 bits ranges.
|
306
306
|
def define_clusters_ip_24
|
307
|
-
|
307
|
+
# Clone keys as we modify the hash in the loop
|
308
|
+
@nodes_graph.keys.clone.each do |node_name|
|
308
309
|
next unless @nodes_graph[node_name][:type] == :node && !@node_metadata[node_name][:private_ips].nil? && !@node_metadata[node_name][:private_ips].empty?
|
309
310
|
|
310
311
|
ip_24 = "#{@node_metadata[node_name][:private_ips].first.split('.')[0..2].join('.')}.0/24"
|
@@ -6,6 +6,7 @@ require 'hybrid_platforms_conductor/actions_executor'
|
|
6
6
|
require 'hybrid_platforms_conductor/cmd_runner'
|
7
7
|
require 'hybrid_platforms_conductor/credentials'
|
8
8
|
require 'hybrid_platforms_conductor/deployer'
|
9
|
+
require 'hybrid_platforms_conductor/executable'
|
9
10
|
require 'hybrid_platforms_conductor/log'
|
10
11
|
require 'hybrid_platforms_conductor/nodes_handler'
|
11
12
|
require 'hybrid_platforms_conductor/platform_handler'
|
@@ -160,6 +161,23 @@ module HybridPlatformsConductorTest
|
|
160
161
|
}
|
161
162
|
)
|
162
163
|
end
|
164
|
+
|
165
|
+
config.around do |example|
|
166
|
+
# Make sure we activate warnings for the example to be run
|
167
|
+
org_warnings = false
|
168
|
+
RSpec.configure do |rspec_config|
|
169
|
+
org_warnings = rspec_config.warnings?
|
170
|
+
rspec_config.warnings = true
|
171
|
+
end
|
172
|
+
begin
|
173
|
+
expect { example.run }.not_to output.to_stderr
|
174
|
+
ensure
|
175
|
+
RSpec.configure do |rspec_config|
|
176
|
+
rspec_config.warnings = org_warnings
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
163
181
|
end
|
164
182
|
|
165
183
|
private
|
@@ -6,8 +6,10 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
6
6
|
with_test_platform_for_action_plugins do |repository|
|
7
7
|
expect(
|
8
8
|
test_actions_executor.execute_actions(
|
9
|
-
|
10
|
-
|
9
|
+
{
|
10
|
+
'node' => {
|
11
|
+
bash: "echo TestContent >#{repository}/test_file ; echo TestStdout ; echo TestStderr 1>&2"
|
12
|
+
}
|
11
13
|
}
|
12
14
|
)['node']
|
13
15
|
).to eq [0, "TestStdout\n", "TestStderr\n"]
|
@@ -4,7 +4,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
4
4
|
|
5
5
|
it 'executes remote interactive session' do
|
6
6
|
with_test_platform_for_action_plugins do
|
7
|
-
test_actions_executor.execute_actions('node' => { interactive: true })
|
7
|
+
test_actions_executor.execute_actions({ 'node' => { interactive: true } })
|
8
8
|
expect(test_actions_executor.connector(:test_connector).calls).to eq [
|
9
9
|
[:connectable_nodes_from, ['node']],
|
10
10
|
[:with_connection_to, ['node'], { no_exception: true }],
|