hybrid_platforms_conductor 32.16.2 → 32.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/README.md +3 -0
- data/bin/last_deploys +4 -1
- data/bin/nodes_to_deploy +5 -5
- data/docs/config_dsl.md +22 -0
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/plugins.md +26 -0
- data/docs/plugins/connector/ssh.md +1 -1
- data/docs/plugins/log/remote_fs.md +26 -0
- data/docs/plugins/test/bitbucket_conf.md +1 -1
- data/docs/plugins/test/check_deploy_and_idempotence.md +1 -1
- data/docs/plugins/test/connection.md +1 -0
- data/docs/plugins/test/deploy_removes_root_access.md +1 -1
- data/docs/plugins/test/file_system.md +1 -0
- data/docs/plugins/test/github_ci.md +48 -0
- data/docs/plugins/test/hostname.md +1 -0
- data/docs/plugins/test/ip.md +1 -0
- data/docs/plugins/test/jenkins_ci_conf.md +1 -1
- data/docs/plugins/test/jenkins_ci_masters_ok.md +1 -1
- data/docs/plugins/test/local_users.md +1 -0
- data/docs/plugins/test/mounts.md +1 -0
- data/docs/plugins/test/orphan_files.md +1 -0
- data/docs/plugins/test/ports.md +1 -0
- data/docs/plugins/test/spectre.md +1 -0
- data/docs/plugins/test/vulnerabilities.md +1 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +8 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +62 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +97 -105
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/my_log_plugin.rb.sample +100 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +179 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -20
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +32 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -1
- data/lib/hybrid_platforms_conductor/log.rb +31 -0
- data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +18 -0
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +22 -6
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +24 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +187 -212
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +72 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +146 -98
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +240 -83
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +2 -1
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +40 -53
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +103 -0
- metadata +30 -2
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/log'
|
2
|
+
|
3
|
+
module HybridPlatformsConductor
|
4
|
+
|
5
|
+
module HpcPlugins
|
6
|
+
|
7
|
+
module Log
|
8
|
+
|
9
|
+
# Save logs on the remote node's file system
|
10
|
+
class RemoteFs < HybridPlatformsConductor::Log
|
11
|
+
|
12
|
+
MARKER_STDOUT = '===== STDOUT ====='
|
13
|
+
MARKER_STDERR = '===== STDERR ====='
|
14
|
+
|
15
|
+
# Get actions to save logs
|
16
|
+
# [API] - This method is mandatory.
|
17
|
+
# [API] - The following API components are accessible:
|
18
|
+
# * *@config* (Config): Main configuration API.
|
19
|
+
# * *@nodes_handler* (NodesHandler): Nodes handler API.
|
20
|
+
# * *@actions_executor* (ActionsExecutor): Actions executor API.
|
21
|
+
#
|
22
|
+
# Parameters::
|
23
|
+
# * *node* (String): Node for which logs are being saved
|
24
|
+
# * *services* (Array<String>): The list of services that have been deployed on this node
|
25
|
+
# * *deployment_info* (Hash<Symbol,Object>): Additional information to attach to the logs
|
26
|
+
# * *exit_status* (Integer or Symbol): Exit status of the deployment
|
27
|
+
# * *stdout* (String): Deployment's stdout
|
28
|
+
# * *stderr* (String): Deployment's stderr
|
29
|
+
# Result::
|
30
|
+
# * Array< Hash<Symbol,Object> >: List of actions to be done
|
31
|
+
def actions_to_save_logs(node, services, deployment_info, exit_status, stdout, stderr)
|
32
|
+
# Create a log file to be scp with all relevant info
|
33
|
+
ssh_user = @actions_executor.connector(:ssh).ssh_user
|
34
|
+
sudo_prefix = ssh_user == 'root' ? '' : "#{@nodes_handler.sudo_on(node)} "
|
35
|
+
log_file = "#{Dir.tmpdir}/hpc_deploy_logs/#{node}_#{Time.now.utc.strftime('%F_%H%M%S')}_#{ssh_user}"
|
36
|
+
[
|
37
|
+
{
|
38
|
+
ruby: proc do
|
39
|
+
FileUtils.mkdir_p File.dirname(log_file)
|
40
|
+
File.write(log_file, <<~EOS)
|
41
|
+
#{
|
42
|
+
deployment_info.merge(
|
43
|
+
debug: log_debug? ? 'Yes' : 'No',
|
44
|
+
services: services.join(', '),
|
45
|
+
exit_status: exit_status
|
46
|
+
).map { |property, value| "#{property}: #{value}" }.join("\n")
|
47
|
+
}
|
48
|
+
#{MARKER_STDOUT}
|
49
|
+
#{stdout}
|
50
|
+
#{MARKER_STDERR}
|
51
|
+
#{stderr}
|
52
|
+
EOS
|
53
|
+
end,
|
54
|
+
remote_bash: "#{sudo_prefix}mkdir -p /var/log/deployments && #{sudo_prefix}chmod 600 /var/log/deployments"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
scp: {
|
58
|
+
log_file => '/var/log/deployments',
|
59
|
+
:sudo => ssh_user != 'root',
|
60
|
+
:owner => 'root',
|
61
|
+
:group => 'root'
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
remote_bash: "#{sudo_prefix}chmod 600 /var/log/deployments/#{File.basename(log_file)}",
|
66
|
+
# Remove temporary files storing logs for security
|
67
|
+
ruby: proc do
|
68
|
+
File.unlink(log_file)
|
69
|
+
end
|
70
|
+
}
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
# Get actions to read logs.
|
75
|
+
# If provided, this method can return some actions to be executed that will fetch logs from servers or remote nodes.
|
76
|
+
# By using this method to run actions instead of the synchronous method logs_from, such actions will be run in parallel which can greatly improve time-consuming operations when querying a lot of nodes.
|
77
|
+
# [API] - This method is optional.
|
78
|
+
# [API] - The following API components are accessible:
|
79
|
+
# * *@config* (Config): Main configuration API.
|
80
|
+
# * *@nodes_handler* (NodesHandler): Nodes handler API.
|
81
|
+
# * *@actions_executor* (ActionsExecutor): Actions executor API.
|
82
|
+
#
|
83
|
+
# Parameters::
|
84
|
+
# * *node* (String): Node for which deployment logs are being read
|
85
|
+
# Result::
|
86
|
+
# * Array< Hash<Symbol,Object> >: List of actions to be done
|
87
|
+
def actions_to_read_logs(node)
|
88
|
+
sudo_prefix = @actions_executor.connector(:ssh).ssh_user == 'root' ? '' : "#{@nodes_handler.sudo_on(node)} "
|
89
|
+
[
|
90
|
+
{ remote_bash: "#{sudo_prefix}cat /var/log/deployments/`#{sudo_prefix}ls -t /var/log/deployments/ | head -1`" }
|
91
|
+
]
|
92
|
+
end
|
93
|
+
|
94
|
+
# Get deployment logs from a node.
|
95
|
+
# This method can use the result of actions previously run to read logs, as returned by the actions_to_read_logs method.
|
96
|
+
# [API] - This method is mandatory.
|
97
|
+
# [API] - The following API components are accessible:
|
98
|
+
# * *@config* (Config): Main configuration API.
|
99
|
+
# * *@nodes_handler* (NodesHandler): Nodes handler API.
|
100
|
+
# * *@actions_executor* (ActionsExecutor): Actions executor API.
|
101
|
+
#
|
102
|
+
# Parameters::
|
103
|
+
# * *node* (String): The node we want deployment logs from
|
104
|
+
# * *exit_status* (Integer, Symbol or nil): Exit status of actions to read logs, or nil if no action was returned by actions_to_read_logs
|
105
|
+
# * *stdout* (String or nil): stdout of actions to read logs, or nil if no action was returned by actions_to_read_logs
|
106
|
+
# * *stderr* (String or nil): stderr of actions to read logs, or nil if no action was returned by actions_to_read_logs
|
107
|
+
# Result::
|
108
|
+
# * Hash<Symbol,Object>: Deployment log information:
|
109
|
+
# * *error* (String): Error string in case deployment logs could not be retrieved. If set then further properties will be ignored. [optional]
|
110
|
+
# * *services* (Array<String>): List of services deployed on the node
|
111
|
+
# * *deployment_info* (Hash<Symbol,Object>): Deployment metadata
|
112
|
+
# * *exit_status* (Integer or Symbol): Deployment exit status
|
113
|
+
# * *stdout* (String): Deployment stdout
|
114
|
+
# * *stderr* (String): Deployment stderr
|
115
|
+
def logs_for(node, exit_status, stdout, stderr)
|
116
|
+
# Expected format for stdout:
|
117
|
+
# Property1: Value1
|
118
|
+
# ...
|
119
|
+
# PropertyN: ValueN
|
120
|
+
# ===== STDOUT =====
|
121
|
+
# ...
|
122
|
+
# ===== STDERR =====
|
123
|
+
# ...
|
124
|
+
if exit_status.is_a?(Symbol)
|
125
|
+
{ error: "Error: #{exit_status}\n#{stderr}" }
|
126
|
+
else
|
127
|
+
stdout_lines = stdout.split("\n")
|
128
|
+
if stdout_lines.first =~ /No such file or directory/
|
129
|
+
{ error: '/var/log/deployments missing' }
|
130
|
+
else
|
131
|
+
stdout_idx = stdout_lines.index(MARKER_STDOUT)
|
132
|
+
stderr_idx = stdout_lines.index(MARKER_STDERR)
|
133
|
+
deploy_info = {}
|
134
|
+
stdout_lines[0..stdout_idx - 1].each do |line|
|
135
|
+
if line =~ /^([^:]+): (.+)$/
|
136
|
+
key_str, value = $1, $2
|
137
|
+
key = key_str.to_sym
|
138
|
+
# Type-cast some values
|
139
|
+
case key_str
|
140
|
+
when 'date'
|
141
|
+
# Date and time values
|
142
|
+
# Thu Nov 23 18:43:01 UTC 2017
|
143
|
+
deploy_info[key] = Time.parse("#{value} UTC")
|
144
|
+
when 'debug'
|
145
|
+
# Boolean values
|
146
|
+
# Yes
|
147
|
+
deploy_info[key] = (value == 'Yes')
|
148
|
+
when /^diff_files_.+$/, 'services'
|
149
|
+
# Array of strings
|
150
|
+
# my_file.txt, other_file.txt
|
151
|
+
deploy_info[key] = value.split(', ')
|
152
|
+
else
|
153
|
+
deploy_info[key] = value
|
154
|
+
end
|
155
|
+
else
|
156
|
+
deploy_info[:unknown_lines] = [] unless deploy_info.key?(:unknown_lines)
|
157
|
+
deploy_info[:unknown_lines] << line
|
158
|
+
end
|
159
|
+
end
|
160
|
+
services = deploy_info.delete(:services)
|
161
|
+
exit_status = deploy_info.delete(:exit_status)
|
162
|
+
{
|
163
|
+
services: services,
|
164
|
+
deployment_info: deploy_info,
|
165
|
+
exit_status: exit_status =~ /^\d+$/ ? Integer(exit_status) : exit_status.to_sym,
|
166
|
+
stdout: stdout_lines[stdout_idx + 1..stderr_idx - 1].join("\n"),
|
167
|
+
stderr: stdout_lines[stderr_idx + 1..-1].join("\n")
|
168
|
+
}
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
@@ -175,11 +175,11 @@ module HybridPlatformsConductor
|
|
175
175
|
end
|
176
176
|
lock_file = "#{File.dirname(policy_file)}/#{File.basename(policy_file, '.rb')}.lock.json"
|
177
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}" unless File.exist?("#{@repository_path}/#{lock_file}")
|
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
179
|
extra_cp_data_bags = File.exist?("#{@repository_path}/data_bags") ? " && cp -ar data_bags/ #{package_dir}/" : ''
|
180
180
|
@cmd_runner.run_cmd "cd #{@repository_path} && \
|
181
181
|
#{@cmd_runner.root? ? '' : 'sudo '}rm -rf #{package_dir} && \
|
182
|
-
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir}#{extra_cp_data_bags}"
|
182
|
+
/opt/chef-workstation/bin/chef export #{policy_file} #{package_dir} --chef-license accept#{extra_cp_data_bags}"
|
183
183
|
end
|
184
184
|
unless @cmd_runner.dry_run
|
185
185
|
# Create secrets file
|
@@ -54,7 +54,7 @@ module HybridPlatformsConductor
|
|
54
54
|
instance.stop
|
55
55
|
instance.with_running_instance(port: 22) do
|
56
56
|
|
57
|
-
unless @nodes_handler.get_root_access_allowed_of(@node)
|
57
|
+
unless @nodes_handler.get_root_access_allowed_of(@node)
|
58
58
|
# ===== Deploy removes root access
|
59
59
|
# Check that we can't connect with root
|
60
60
|
ssh_ok = false
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the connection works by simply outputing something
|
8
|
-
class Connection <
|
10
|
+
class Connection < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
TEST_CONNECTION_STRING = 'Test connection - ok'
|
11
13
|
|
@@ -12,27 +12,14 @@ module HybridPlatformsConductor
|
|
12
12
|
MAX_ACCEPTABLE_REFRESH_PERIOD_SECS = 3 * 31 * 24 * 60 * 60 # 3 months
|
13
13
|
|
14
14
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
15
|
-
def
|
15
|
+
def test_for_node
|
16
16
|
now = Time.now
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
else
|
24
|
-
# Expecting following file names
|
25
|
-
# node-name_2017-12-01_093418_user-name
|
26
|
-
file_match = stdout.first.match(/^#{Regexp.escape(@node)}_(\d{4}-\d{2}-\d{2})_.+$/)
|
27
|
-
if file_match.nil?
|
28
|
-
error "Invalid chef deployment log file found: #{stdout.first}"
|
29
|
-
else
|
30
|
-
last_deploy_time = Time.parse(file_match[1])
|
31
|
-
error "Last deployment has been done on #{last_deploy_time.strftime('%F')}. Should refresh it." if now - last_deploy_time > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
}
|
17
|
+
deploy_info = @deployer.deployment_info_from(@node)[@node]
|
18
|
+
if deploy_info.key?(:error)
|
19
|
+
error "Error while getting deployment info: #{deploy_info[:error]}"
|
20
|
+
elsif Time.now.utc - deploy_info[:deployment_info][:date] > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS
|
21
|
+
error "Last deployment has been done on #{deploy_info[:deployment_info][:date].strftime('%F')}. Should refresh it."
|
22
|
+
end
|
36
23
|
end
|
37
24
|
|
38
25
|
end
|
@@ -12,7 +12,7 @@ module HybridPlatformsConductor
|
|
12
12
|
|
13
13
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
14
14
|
def test_for_node
|
15
|
-
unless @nodes_handler.get_root_access_allowed_of(@node)
|
15
|
+
unless @nodes_handler.get_root_access_allowed_of(@node)
|
16
16
|
@deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_removes_root_access', reuse_instance: log_debug?) do |deployer, instance|
|
17
17
|
# Check that we can connect with root
|
18
18
|
ssh_ok = false
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
1
2
|
require 'hybrid_platforms_conductor/common_config_dsl/file_system_tests'
|
2
3
|
|
3
4
|
module HybridPlatformsConductor
|
@@ -7,7 +8,7 @@ module HybridPlatformsConductor
|
|
7
8
|
module Test
|
8
9
|
|
9
10
|
# Perform various tests on a node's file system
|
10
|
-
class FileSystem <
|
11
|
+
class FileSystem < TestOnlyRemoteNode
|
11
12
|
|
12
13
|
self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
|
13
14
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/common_config_dsl/github'
|
2
|
+
|
3
|
+
module HybridPlatformsConductor
|
4
|
+
|
5
|
+
module HpcPlugins
|
6
|
+
|
7
|
+
module Test
|
8
|
+
|
9
|
+
# Check that all repositories have a successful Github CI
|
10
|
+
class GithubCi < HybridPlatformsConductor::Test
|
11
|
+
|
12
|
+
self.extend_config_dsl_with CommonConfigDsl::Github, :init_github
|
13
|
+
|
14
|
+
# Check my_test_plugin.rb.sample documentation for signature details.
|
15
|
+
def test
|
16
|
+
@config.for_each_github_repo do |client, repo_info|
|
17
|
+
log_debug "Checking CI for Github repository #{repo_info[:slug]}"
|
18
|
+
last_status = client.repository_workflow_runs(repo_info[:slug])[:workflow_runs].
|
19
|
+
select { |run| run[:head_branch] == 'master' }.
|
20
|
+
sort_by { |run| run[:created_at] }.
|
21
|
+
last[:conclusion]
|
22
|
+
error "Last workflow status for repository #{repo_info[:slug]} is #{last_status}" unless last_status == 'success'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the hostname is correct
|
8
|
-
class Hostname <
|
10
|
+
class Hostname < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
11
13
|
def test_on_node
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the private IP address is correct
|
8
|
-
class Ip <
|
10
|
+
class Ip < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Check my_test_plugin.rb.sample documentation for signature details.
|
11
13
|
def test_on_node
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the node's local users
|
8
|
-
class LocalUsers <
|
10
|
+
class LocalUsers < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Config DSL extension for this test plugin
|
11
13
|
module ConfigDslExtension
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Various tests on mounts
|
8
|
-
class Mounts <
|
10
|
+
class Mounts < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Config DSL extension for this test plugin
|
11
13
|
module ConfigDslExtension
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the node has no orphan files
|
8
|
-
class OrphanFiles <
|
10
|
+
class OrphanFiles < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Config DSL extension for this test plugin
|
11
13
|
module ConfigDslExtension
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Various tests on ports
|
8
|
-
class Ports <
|
10
|
+
class Ports < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
# Config DSL extension for this test plugin
|
11
13
|
module ConfigDslExtension
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
|
+
|
1
3
|
module HybridPlatformsConductor
|
2
4
|
|
3
5
|
module HpcPlugins
|
@@ -5,7 +7,7 @@ module HybridPlatformsConductor
|
|
5
7
|
module Test
|
6
8
|
|
7
9
|
# Test that the vulnerabilities Spectre and Meltdown are patched
|
8
|
-
class Spectre <
|
10
|
+
class Spectre < TestOnlyRemoteNode
|
9
11
|
|
10
12
|
VULNERABILITIES_TO_CHECK = {
|
11
13
|
'CVE-2017-5753' => 'Spectre Variant 1',
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
+
require 'hybrid_platforms_conductor/test_only_remote_node'
|
2
3
|
|
3
4
|
module HybridPlatformsConductor
|
4
5
|
|
@@ -17,7 +18,7 @@ module HybridPlatformsConductor
|
|
17
18
|
# Each final OVAL URL can be directly an XML file, either raw or compressed with .gz or .bz2.
|
18
19
|
# This is useful to follow repository links, such as jFrog or web servers serving common file systems structure storing several versions of the OVAL file.
|
19
20
|
# * *reported_severities* (Array<String> or nil): List of severities to report, if any (use Unknown when the severity is not known), or nil for all [default: nil]
|
20
|
-
class Vulnerabilities <
|
21
|
+
class Vulnerabilities < TestOnlyRemoteNode
|
21
22
|
|
22
23
|
# Known compression methods, per file extension, and their corresponding uncompress bash script
|
23
24
|
KNOWN_COMPRESSIONS = {
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
2
|
+
require 'hybrid_platforms_conductor/plugin'
|
3
|
+
|
4
|
+
module HybridPlatformsConductor
|
5
|
+
|
6
|
+
# Ancestor of all log plugins
|
7
|
+
class Log < 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
|
+
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
16
|
+
# * *actions_executor* (ActionsExecutor): Actions executor to be used. [default: ActionsExecutor.new]
|
17
|
+
def initialize(
|
18
|
+
logger: Logger.new(STDOUT),
|
19
|
+
logger_stderr: Logger.new(STDERR),
|
20
|
+
config: Config.new,
|
21
|
+
nodes_handler: NodesHandler.new,
|
22
|
+
actions_executor: ActionsExecutor.new
|
23
|
+
)
|
24
|
+
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
25
|
+
@nodes_handler = nodes_handler
|
26
|
+
@actions_executor = actions_executor
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|