dopi 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +322 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +102 -0
- data/LICENSE.txt +177 -0
- data/README.md +309 -0
- data/Rakefile +44 -0
- data/Vagrantfile +64 -0
- data/bin/dopi +4 -0
- data/doc/getting_started.md +247 -0
- data/doc/getting_started_examples/001_hello_world.yaml +17 -0
- data/doc/getting_started_examples/002_connecting_over_ssh.yaml +35 -0
- data/doc/plugins/custom.md +88 -0
- data/doc/plugins/mco/rpc.md +82 -0
- data/doc/plugins/ssh/custom.md +141 -0
- data/doc/plugins/ssh/file_contains.md +37 -0
- data/doc/plugins/ssh/file_deploy.md +52 -0
- data/doc/plugins/ssh/file_exists.md +31 -0
- data/doc/plugins/ssh/file_replace.md +37 -0
- data/doc/plugins/ssh/puppet_agent_run.md +50 -0
- data/doc/plugins/ssh/reboot.md +22 -0
- data/doc/plugins/ssh/wait_for_login.md +53 -0
- data/doc/plugins/winrm/cmd.md +161 -0
- data/doc/plugins/winrm/file_contains.md +39 -0
- data/doc/plugins/winrm/file_exists.md +31 -0
- data/doc/plugins/winrm/powershell.md +27 -0
- data/doc/plugins/winrm/puppet_agent_run.md +49 -0
- data/doc/plugins/winrm/reboot.md +17 -0
- data/doc/plugins/winrm/wait_for_login.md +55 -0
- data/dopi.gemspec +42 -0
- data/lib/dopi/cli/command_add.rb +35 -0
- data/lib/dopi/cli/command_list.rb +19 -0
- data/lib/dopi/cli/command_remove.rb +31 -0
- data/lib/dopi/cli/command_reset.rb +27 -0
- data/lib/dopi/cli/command_run.rb +68 -0
- data/lib/dopi/cli/command_show.rb +109 -0
- data/lib/dopi/cli/command_update.rb +37 -0
- data/lib/dopi/cli/command_validate.rb +27 -0
- data/lib/dopi/cli/global_options.rb +55 -0
- data/lib/dopi/cli/log.rb +33 -0
- data/lib/dopi/cli.rb +57 -0
- data/lib/dopi/command/custom.rb +52 -0
- data/lib/dopi/command/dummy.rb +27 -0
- data/lib/dopi/command/mco/rpc.rb +158 -0
- data/lib/dopi/command/ssh/custom.rb +48 -0
- data/lib/dopi/command/ssh/file_contains.rb +70 -0
- data/lib/dopi/command/ssh/file_deploy.rb +71 -0
- data/lib/dopi/command/ssh/file_exists.rb +54 -0
- data/lib/dopi/command/ssh/file_replace.rb +96 -0
- data/lib/dopi/command/ssh/puppet_agent_run.rb +63 -0
- data/lib/dopi/command/ssh/reboot.rb +50 -0
- data/lib/dopi/command/ssh/wait_for_login.rb +68 -0
- data/lib/dopi/command/winrm/cmd.rb +44 -0
- data/lib/dopi/command/winrm/file_contains.rb +66 -0
- data/lib/dopi/command/winrm/file_exists.rb +51 -0
- data/lib/dopi/command/winrm/powershell.rb +16 -0
- data/lib/dopi/command/winrm/puppet_agent_run.rb +61 -0
- data/lib/dopi/command/winrm/reboot.rb +33 -0
- data/lib/dopi/command/winrm/wait_for_login.rb +49 -0
- data/lib/dopi/command.rb +239 -0
- data/lib/dopi/command_parser/arguments.rb +38 -0
- data/lib/dopi/command_parser/credentials.rb +59 -0
- data/lib/dopi/command_parser/env.rb +37 -0
- data/lib/dopi/command_parser/exec.rb +27 -0
- data/lib/dopi/command_parser/exit_code.rb +73 -0
- data/lib/dopi/command_parser/output.rb +126 -0
- data/lib/dopi/command_set.rb +66 -0
- data/lib/dopi/connector/local.rb +77 -0
- data/lib/dopi/connector/ssh.rb +170 -0
- data/lib/dopi/connector/winrm.rb +167 -0
- data/lib/dopi/error.rb +43 -0
- data/lib/dopi/log.rb +18 -0
- data/lib/dopi/node.rb +70 -0
- data/lib/dopi/plan.rb +99 -0
- data/lib/dopi/pluginmanager.rb +62 -0
- data/lib/dopi/state.rb +226 -0
- data/lib/dopi/state_store.rb +155 -0
- data/lib/dopi/step.rb +227 -0
- data/lib/dopi/step_set.rb +70 -0
- data/lib/dopi/version.rb +3 -0
- data/lib/dopi.rb +165 -0
- data/spec/command_helper.rb +11 -0
- data/spec/fixtures/mco_client.cfg +26 -0
- data/spec/fixtures/plans/fail_on_timeout.yaml +20 -0
- data/spec/fixtures/plans/hello_world.yaml +34 -0
- data/spec/fixtures/plans/non_existing_node.yaml +26 -0
- data/spec/fixtures/plans/test_role_variable.yaml +29 -0
- data/spec/fixtures/puppet/Puppetfile +8 -0
- data/spec/fixtures/puppet/Puppetfile.lock +57 -0
- data/spec/fixtures/puppet/hiera.yaml +6 -0
- data/spec/fixtures/puppet/manifests/site.pp +52 -0
- data/spec/fixtures/test_configuration.yaml +54 -0
- data/spec/fixtures/test_credentials.yaml +11 -0
- data/spec/fixtures/test_deloyed_file.txt +5 -0
- data/spec/fixtures/test_infrastructure.yaml +12 -0
- data/spec/fixtures/test_nodes.yaml +45 -0
- data/spec/fixtures/testenv_plan.yaml +159 -0
- data/spec/integration/dopi/addrun_spec.rb +31 -0
- data/spec/integration/dopi/cli/command_run_spec.rb +38 -0
- data/spec/integration/dopi/cli/global_options_spec.rb +128 -0
- data/spec/integration/dopi/command_spec.rb +66 -0
- data/spec/integration/dopi/fail_check_plans/file_exists_fails.yaml +38 -0
- data/spec/integration/dopi/fail_check_plans/output_parser.yaml +39 -0
- data/spec/integration/dopi/fail_check_plans/powershell_fail.yaml +25 -0
- data/spec/integration/dopi/fail_check_plans/timeout.yaml +29 -0
- data/spec/integration/dopi/fail_check_plans/verify_commands.yaml +33 -0
- data/spec/integration/dopi/failplan.rb +27 -0
- data/spec/integration/dopi/plan.rb +27 -0
- data/spec/integration/dopi/plans/dummy.yaml +29 -0
- data/spec/integration/dopi/plans/max_per_role.yaml +55 -0
- data/spec/integration/dopi/plans/no_timeout.yaml +29 -0
- data/spec/integration/dopi/plans/node_and_role_patterns.yaml +58 -0
- data/spec/integration/dopi/plans/node_by_config.yaml +116 -0
- data/spec/integration/dopi/plans/plugin_defaults.yaml +86 -0
- data/spec/integration/dopi/plans/plugins/mco/rpc.yaml +33 -0
- data/spec/integration/dopi/plans/plugins/ssh/custom.yaml +97 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_contains.yaml +51 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_deploy.yaml +82 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_exists.yaml +69 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_replace.yaml +55 -0
- data/spec/integration/dopi/plans/plugins/ssh/puppet_agent_run.yaml +45 -0
- data/spec/integration/dopi/plans/plugins/ssh/reboot.yaml +43 -0
- data/spec/integration/dopi/plans/plugins/ssh/wait_for_login.yaml +45 -0
- data/spec/integration/dopi/plans/plugins/winrm/cmd.yaml +39 -0
- data/spec/integration/dopi/plans/plugins/winrm/file_contains.yaml +51 -0
- data/spec/integration/dopi/plans/plugins/winrm/file_exists.yaml +69 -0
- data/spec/integration/dopi/plans/plugins/winrm/reboot.yaml +31 -0
- data/spec/integration/dopi/plans/resolve_roles_on_validate.yaml +23 -0
- data/spec/integration/dopi/plans/ssh_parallel.yaml +37 -0
- data/spec/integration/dopi/plans/verify_commands.yaml +49 -0
- data/spec/spec_helper.rb +104 -0
- data/spec/unit/dopi/command/custom_spec.rb +58 -0
- data/spec/unit/dopi/command/mco/rpc_spec.rb +157 -0
- data/spec/unit/dopi/command/ssh/custom_spec.rb +30 -0
- data/spec/unit/dopi/command/ssh/file_deploy_spec.rb +42 -0
- data/spec/unit/dopi/command/ssh/file_replace_spec.rb +35 -0
- data/spec/unit/dopi/command_parser/credentials_spec.rb +53 -0
- data/spec/unit/dopi/command_parser/exit_code_spec.rb +63 -0
- data/spec/unit/dopi/command_parser/output_spec.rb +129 -0
- data/spec/unit/dopi/command_spec.rb +14 -0
- data/spec/unit/dopi/connector/winrm_spec.rb +111 -0
- data/spec/unit/dopi/node_spec.rb +24 -0
- data/spec/unit/dopi/plan_spec.rb +31 -0
- data/spec/unit/dopi/state_spec.rb +109 -0
- data/spec/unit/dopi/step_spec.rb +13 -0
- metadata +448 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
name: 'test_powershell_exitcode_handling'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'windows01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
|
12
|
+
credentials:
|
13
|
+
'windows_login':
|
14
|
+
type: 'username_password'
|
15
|
+
username: 'administrator'
|
16
|
+
password: 'vagrant'
|
17
|
+
|
18
|
+
steps:
|
19
|
+
|
20
|
+
- name: 'Check if the command is skipped if the file does exist'
|
21
|
+
nodes: 'all'
|
22
|
+
command:
|
23
|
+
plugin: 'winrm/powershell'
|
24
|
+
credentials: 'windows_login'
|
25
|
+
exec: 'ThisCommandDoesNotExist'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: 'test_timeout'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
|
12
|
+
credentials:
|
13
|
+
'linux_login':
|
14
|
+
type: 'username_password'
|
15
|
+
username: 'root'
|
16
|
+
password: 'puppet'
|
17
|
+
|
18
|
+
steps:
|
19
|
+
|
20
|
+
- name: 'sleep and wait for timeout'
|
21
|
+
nodes: 'all'
|
22
|
+
set_plugin_defaults:
|
23
|
+
- plugins: '/^ssh/'
|
24
|
+
credentials: 'linux_login'
|
25
|
+
command:
|
26
|
+
plugin: 'ssh/custom'
|
27
|
+
exec: 'sleep'
|
28
|
+
arguments: '10'
|
29
|
+
plugin_timeout: 1
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: 'verify_command_tests_fail'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
|
12
|
+
credentials:
|
13
|
+
'linux_login':
|
14
|
+
type: 'username_password'
|
15
|
+
username: 'root'
|
16
|
+
password: 'puppet'
|
17
|
+
|
18
|
+
steps:
|
19
|
+
|
20
|
+
- name: 'write the test file'
|
21
|
+
nodes: 'all'
|
22
|
+
set_plugin_defaults:
|
23
|
+
- plugins: '/^ssh/'
|
24
|
+
credentials: 'linux_login'
|
25
|
+
command:
|
26
|
+
verify_commands:
|
27
|
+
- plugin: 'ssh/file_exists'
|
28
|
+
file: '/tmp/non_existing_file'
|
29
|
+
verify_after_run: true
|
30
|
+
plugin: 'ssh/custom'
|
31
|
+
exec: 'echo'
|
32
|
+
arguments: 'do nothing'
|
33
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
DopCommon.config.mco_config = 'spec/fixtures/mco_client.cfg'
|
4
|
+
DopCommon.config.hiera_yaml = 'spec/fixtures/puppet/hiera.yaml'
|
5
|
+
|
6
|
+
describe 'Run specific plan that should fail' do
|
7
|
+
|
8
|
+
# Create plugin test from specific yaml file
|
9
|
+
# and check if it fails
|
10
|
+
plan_file = "spec/integration/dopi/fail_check_plans/#{ENV['DOPI_TEST_PLAN']}.yaml"
|
11
|
+
describe plan_file do
|
12
|
+
plan_parser = DopCommon::Plan.new(YAML.load_file(plan_file))
|
13
|
+
plan = Dopi::Plan.new(plan_parser)
|
14
|
+
it "is a valid plan file" do
|
15
|
+
expect(plan.valid?).to be true
|
16
|
+
end
|
17
|
+
plan.step_sets.each do |step_set|
|
18
|
+
step_set.steps.each do |step|
|
19
|
+
it "successfully runs the step: '#{step.name}'" do
|
20
|
+
step.run({:run_for_nodes => :all, :noop => false})
|
21
|
+
expect(step.state).to be :failed
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
DopCommon.config.mco_config = 'spec/fixtures/mco_client.cfg'
|
4
|
+
DopCommon.config.hiera_yaml = 'spec/fixtures/puppet/hiera.yaml'
|
5
|
+
|
6
|
+
describe 'Run specific plan that should complete' do
|
7
|
+
|
8
|
+
# Create plugin test from specific yaml file
|
9
|
+
# and check it completes
|
10
|
+
plan_file = "spec/integration/dopi/plans/#{ENV['DOPI_TEST_PLAN']}.yaml"
|
11
|
+
describe plan_file do
|
12
|
+
plan_parser = DopCommon::Plan.new(YAML.load_file(plan_file))
|
13
|
+
plan = Dopi::Plan.new(plan_parser)
|
14
|
+
it "is a valid plan file" do
|
15
|
+
expect(plan.valid?).to be true
|
16
|
+
end
|
17
|
+
plan.step_sets.each do |step_set|
|
18
|
+
step_set.steps.each do |step|
|
19
|
+
it "successfully runs the step: '#{step.name}'" do
|
20
|
+
step.run({:run_for_nodes => :all, :noop => false})
|
21
|
+
expect(step.state).to be :done
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: 'test_dummy'
|
2
|
+
max_in_flight: 2
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
'linux02.example.com':
|
12
|
+
infrastructure: 'test'
|
13
|
+
|
14
|
+
credentials:
|
15
|
+
'linux_login':
|
16
|
+
type: 'username_password'
|
17
|
+
username: 'root'
|
18
|
+
password: 'puppet'
|
19
|
+
|
20
|
+
steps:
|
21
|
+
|
22
|
+
- name: 'Run true command'
|
23
|
+
nodes: 'all'
|
24
|
+
set_plugin_defaults:
|
25
|
+
- plugins: '/^ssh/'
|
26
|
+
credentials: 'linux_login'
|
27
|
+
command:
|
28
|
+
plugin: 'ssh/custom'
|
29
|
+
exec: 'true'
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: 'test_max_per_role'
|
2
|
+
max_in_flight: -1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
'linux02.example.com':
|
12
|
+
infrastructure: 'test'
|
13
|
+
'linux03.example.com':
|
14
|
+
infrastructure: 'test'
|
15
|
+
|
16
|
+
credentials:
|
17
|
+
'linux_login':
|
18
|
+
type: 'username_password'
|
19
|
+
username: 'root'
|
20
|
+
password: 'puppet'
|
21
|
+
|
22
|
+
configuration:
|
23
|
+
defaults:
|
24
|
+
role: 'base'
|
25
|
+
|
26
|
+
steps:
|
27
|
+
|
28
|
+
- name: 'configure credentials'
|
29
|
+
nodes: 'all'
|
30
|
+
set_plugin_defaults:
|
31
|
+
- plugins: '/^ssh/'
|
32
|
+
credentials: 'linux_login'
|
33
|
+
command: 'dummy'
|
34
|
+
|
35
|
+
- name: 'reboot nodes and check if the other nodes stay up'
|
36
|
+
nodes: 'all'
|
37
|
+
max_per_role: 1
|
38
|
+
commands:
|
39
|
+
- plugin: 'ssh/custom'
|
40
|
+
exec: 'reboot'
|
41
|
+
expect_exit_codes: 255
|
42
|
+
- plugin: 'custom'
|
43
|
+
exec: 'sleep'
|
44
|
+
arguments: '2'
|
45
|
+
- plugin: 'custom'
|
46
|
+
exec: 'ping'
|
47
|
+
arguments: '-w 2 -c 1 linux01.example.com || [ "$DOP_NODE_FQDN" == "linux01.example.com" ]'
|
48
|
+
- plugin: 'custom'
|
49
|
+
exec: 'ping'
|
50
|
+
arguments: '-w 2 -c 1 linux02.example.com || [ "$DOP_NODE_FQDN" == "linux02.example.com" ]'
|
51
|
+
- plugin: 'custom'
|
52
|
+
exec: 'ping'
|
53
|
+
arguments: '-w 2 -c 1 linux03.example.com || [ "$DOP_NODE_FQDN" == "linux03.example.com" ]'
|
54
|
+
- 'ssh/wait_for_login'
|
55
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: 'test_timeout'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
|
12
|
+
credentials:
|
13
|
+
'linux_login':
|
14
|
+
type: 'username_password'
|
15
|
+
username: 'root'
|
16
|
+
password: 'puppet'
|
17
|
+
|
18
|
+
steps:
|
19
|
+
|
20
|
+
- name: 'sleep and wait for timeout'
|
21
|
+
nodes: 'all'
|
22
|
+
set_plugin_defaults:
|
23
|
+
- plugins: '/^ssh/'
|
24
|
+
credentials: 'linux_login'
|
25
|
+
command:
|
26
|
+
plugin: 'ssh/custom'
|
27
|
+
exec: 'sleep'
|
28
|
+
arguments: '1'
|
29
|
+
plugin_timeout: 10
|
@@ -0,0 +1,58 @@
|
|
1
|
+
name: 'node_and_role_patterns'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
'nonexisting01.example.com':
|
12
|
+
infrastructure: 'test'
|
13
|
+
'nonexisting02.example.com':
|
14
|
+
infrastructure: 'test'
|
15
|
+
'nonexisting03.example.com':
|
16
|
+
infrastructure: 'test'
|
17
|
+
|
18
|
+
credentials:
|
19
|
+
'linux_login':
|
20
|
+
type: 'username_password'
|
21
|
+
username: 'root'
|
22
|
+
password: 'puppet'
|
23
|
+
|
24
|
+
configuration:
|
25
|
+
nodes:
|
26
|
+
'linux01.example.com':
|
27
|
+
role: 'isreal'
|
28
|
+
'nonexisting01.example.com':
|
29
|
+
role: 'unreal'
|
30
|
+
'nonexisting02.example.com':
|
31
|
+
role: 'unreal'
|
32
|
+
'nonexisting03.example.com':
|
33
|
+
role: 'unreal'
|
34
|
+
|
35
|
+
steps:
|
36
|
+
|
37
|
+
- name: 'Step which includes and excludes nodes with a regexp'
|
38
|
+
nodes:
|
39
|
+
- '/.*\.example\.com$/'
|
40
|
+
exclude_nodes:
|
41
|
+
- '/^nonexisting.*/'
|
42
|
+
command:
|
43
|
+
plugin: 'ssh/custom'
|
44
|
+
credentials: 'linux_login'
|
45
|
+
exec: 'echo'
|
46
|
+
arguments: '"Hello World"'
|
47
|
+
|
48
|
+
- name: 'Step which includes and excludes roles with a regexp'
|
49
|
+
roles:
|
50
|
+
- '/.*real$/'
|
51
|
+
exclude_roles:
|
52
|
+
- '/^un.*/'
|
53
|
+
command:
|
54
|
+
plugin: 'ssh/custom'
|
55
|
+
credentials: 'linux_login'
|
56
|
+
exec: 'echo'
|
57
|
+
arguments: '"Hello World"'
|
58
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
name: 'nodes_by_config'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
'nonexisting01.example.com':
|
12
|
+
infrastructure: 'test'
|
13
|
+
'nonexisting02.example.com':
|
14
|
+
infrastructure: 'test'
|
15
|
+
|
16
|
+
credentials:
|
17
|
+
'linux_login':
|
18
|
+
type: 'username_password'
|
19
|
+
username: 'root'
|
20
|
+
password: 'puppet'
|
21
|
+
|
22
|
+
configuration:
|
23
|
+
nodes:
|
24
|
+
'linux01.example.com':
|
25
|
+
my_alias: 'realnode'
|
26
|
+
my_alias2: 'include_this'
|
27
|
+
my_alias3: 'dont_exclude_this'
|
28
|
+
my_alias4: 'only_include_this'
|
29
|
+
my_alias5:
|
30
|
+
- 'include_this'
|
31
|
+
- 'dont_exclude_this'
|
32
|
+
'nonexisting01.example.com':
|
33
|
+
my_alias: 'fakenode'
|
34
|
+
my_alias2: 'include_this'
|
35
|
+
my_alias3: 'exclude_this'
|
36
|
+
my_alias5:
|
37
|
+
- 'include_this'
|
38
|
+
- 'exclude_this'
|
39
|
+
my_alias6: 'exclude_this'
|
40
|
+
my_alias8: 'exclude_this'
|
41
|
+
'nonexisting02.example.com':
|
42
|
+
my_alias: 'fakenode'
|
43
|
+
my_alias2: 'include_this'
|
44
|
+
my_alias3: 'exclude_this'
|
45
|
+
my_alias5:
|
46
|
+
- 'include_this'
|
47
|
+
- 'exclude_this'
|
48
|
+
my_alias7: 'exclude_this'
|
49
|
+
my_alias8: 'exclude_this_too'
|
50
|
+
|
51
|
+
steps:
|
52
|
+
- name: 'Include and exclude with regexp pattern'
|
53
|
+
nodes_by_config:
|
54
|
+
my_alias: '/node$/'
|
55
|
+
exclude_nodes_by_config:
|
56
|
+
my_alias: '/^fake/'
|
57
|
+
command:
|
58
|
+
plugin: 'ssh/custom'
|
59
|
+
credentials: 'linux_login'
|
60
|
+
exec: 'echo'
|
61
|
+
arguments: 'Hello World'
|
62
|
+
|
63
|
+
- name: 'Include and exclude with string compare'
|
64
|
+
nodes_by_config:
|
65
|
+
my_alias2: 'include_this'
|
66
|
+
exclude_nodes_by_config:
|
67
|
+
my_alias3: 'exclude_this'
|
68
|
+
command:
|
69
|
+
plugin: 'ssh/custom'
|
70
|
+
credentials: 'linux_login'
|
71
|
+
exec: 'echo'
|
72
|
+
arguments: 'Hello World'
|
73
|
+
|
74
|
+
- name: 'Check if it works if my_alias4 is only set for some nodes'
|
75
|
+
nodes_by_config:
|
76
|
+
my_alias4: 'only_include_this'
|
77
|
+
command:
|
78
|
+
plugin: 'ssh/custom'
|
79
|
+
credentials: 'linux_login'
|
80
|
+
exec: 'echo'
|
81
|
+
arguments: 'Hello World'
|
82
|
+
|
83
|
+
- name: 'Check if it works if my_alias5 is an array of aliases'
|
84
|
+
nodes_by_config:
|
85
|
+
my_alias5: 'include_this'
|
86
|
+
exclude_nodes_by_config:
|
87
|
+
my_alias5: 'exclude_this'
|
88
|
+
command:
|
89
|
+
plugin: 'ssh/custom'
|
90
|
+
credentials: 'linux_login'
|
91
|
+
exec: 'echo'
|
92
|
+
arguments: 'Hello World'
|
93
|
+
|
94
|
+
- name: 'exclude an array of aliases'
|
95
|
+
nodes: 'all'
|
96
|
+
exclude_nodes_by_config:
|
97
|
+
my_alias6: 'exclude_this'
|
98
|
+
my_alias7: 'exclude_this'
|
99
|
+
command:
|
100
|
+
plugin: 'ssh/custom'
|
101
|
+
credentials: 'linux_login'
|
102
|
+
exec: 'echo'
|
103
|
+
arguments: 'Hello World'
|
104
|
+
|
105
|
+
- name: 'exclude an array of aliases'
|
106
|
+
nodes: 'all'
|
107
|
+
exclude_nodes_by_config:
|
108
|
+
my_alias8:
|
109
|
+
- 'exclude_this'
|
110
|
+
- 'exclude_this_too'
|
111
|
+
command:
|
112
|
+
plugin: 'ssh/custom'
|
113
|
+
credentials: 'linux_login'
|
114
|
+
exec: 'echo'
|
115
|
+
arguments: 'Hello World'
|
116
|
+
|
@@ -0,0 +1,86 @@
|
|
1
|
+
name: 'plugin_defaults_tests'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
|
5
|
+
infrastructures:
|
6
|
+
'test':
|
7
|
+
type: 'baremetal'
|
8
|
+
|
9
|
+
nodes:
|
10
|
+
'linux01.example.com':
|
11
|
+
infrastructure: 'test'
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- name: 'Check if the default settings work'
|
15
|
+
nodes: 'all'
|
16
|
+
set_plugin_defaults:
|
17
|
+
- plugin: 'custom'
|
18
|
+
:env:
|
19
|
+
FOO: 'foo'
|
20
|
+
command:
|
21
|
+
plugin: 'custom'
|
22
|
+
exec: 'test'
|
23
|
+
arguments: '${FOO} = foo'
|
24
|
+
|
25
|
+
- name: 'Check if the default settings are persistant'
|
26
|
+
nodes: 'all'
|
27
|
+
command:
|
28
|
+
plugin: 'custom'
|
29
|
+
exec: 'test'
|
30
|
+
arguments: '${FOO} = foo'
|
31
|
+
|
32
|
+
- name: 'Check if the deletion of all settings works'
|
33
|
+
nodes: 'all'
|
34
|
+
delete_plugin_defaults: 'all'
|
35
|
+
command:
|
36
|
+
plugin: 'custom'
|
37
|
+
exec: 'test'
|
38
|
+
arguments: '${FOO} = foo'
|
39
|
+
expect_exit_codes: 2
|
40
|
+
|
41
|
+
- name: 'Check if setting it with a Regexp who does not match still not sets it for this plugin'
|
42
|
+
nodes: 'all'
|
43
|
+
set_plugin_defaults:
|
44
|
+
- plugin: '/notthisplugin/'
|
45
|
+
:env:
|
46
|
+
FOO: 'foo'
|
47
|
+
command:
|
48
|
+
plugin: 'custom'
|
49
|
+
exec: 'test'
|
50
|
+
arguments: '${FOO} = foo'
|
51
|
+
expect_exit_codes: 2
|
52
|
+
|
53
|
+
- name: 'Check if setting it with a Regexp works'
|
54
|
+
nodes: 'all'
|
55
|
+
set_plugin_defaults:
|
56
|
+
- plugin: '/cust/'
|
57
|
+
:env:
|
58
|
+
FOO: 'foo'
|
59
|
+
command:
|
60
|
+
plugin: 'custom'
|
61
|
+
exec: 'test'
|
62
|
+
arguments: '${FOO} = foo'
|
63
|
+
|
64
|
+
- name: 'Check if deletion of other settings does not remove our settings'
|
65
|
+
nodes: 'all'
|
66
|
+
delete_plugin_defaults:
|
67
|
+
- plugins: '/ssh/'
|
68
|
+
delete_keys:
|
69
|
+
- :env
|
70
|
+
command:
|
71
|
+
plugin: 'custom'
|
72
|
+
exec: 'test'
|
73
|
+
arguments: '${FOO} = foo'
|
74
|
+
|
75
|
+
- name: 'Check if deletion of specific keys works'
|
76
|
+
nodes: 'all'
|
77
|
+
delete_plugin_defaults:
|
78
|
+
- plugins: 'custom'
|
79
|
+
delete_keys:
|
80
|
+
- :env
|
81
|
+
command:
|
82
|
+
plugin: 'custom'
|
83
|
+
exec: 'test'
|
84
|
+
arguments: '${FOO} = foo'
|
85
|
+
expect_exit_codes: 2
|
86
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
name: 'plugin_test_mco_rpc'
|
3
|
+
max_in_flight: 1
|
4
|
+
|
5
|
+
infrastructures:
|
6
|
+
'test':
|
7
|
+
type: 'baremetal'
|
8
|
+
|
9
|
+
nodes:
|
10
|
+
'linux01.example.com':
|
11
|
+
infrastructure: 'test'
|
12
|
+
|
13
|
+
steps:
|
14
|
+
|
15
|
+
- name: 'Mcollective retrieve node inventory'
|
16
|
+
nodes: 'all'
|
17
|
+
command:
|
18
|
+
plugin: 'mco/rpc'
|
19
|
+
agent: 'rpcutil'
|
20
|
+
action: 'inventory'
|
21
|
+
|
22
|
+
- name: 'Mcollective retrieve a fact'
|
23
|
+
nodes: 'all'
|
24
|
+
command:
|
25
|
+
plugin: 'mco/rpc'
|
26
|
+
agent: 'rpcutil'
|
27
|
+
action: 'get_fact'
|
28
|
+
arguments:
|
29
|
+
:fact: 'osfamily'
|
30
|
+
options:
|
31
|
+
:timeout: 30
|
32
|
+
:ttl: 60
|
33
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
name: 'ssh_customs_plugin_test'
|
2
|
+
max_in_flight: 1
|
3
|
+
|
4
|
+
infrastructures:
|
5
|
+
'test':
|
6
|
+
type: 'baremetal'
|
7
|
+
|
8
|
+
nodes:
|
9
|
+
'linux01.example.com':
|
10
|
+
infrastructure: 'test'
|
11
|
+
'linux02.example.com':
|
12
|
+
infrastructure: 'test'
|
13
|
+
'linux03.example.com':
|
14
|
+
infrastructure: 'test'
|
15
|
+
|
16
|
+
credentials:
|
17
|
+
'linux_login':
|
18
|
+
type: 'username_password'
|
19
|
+
username: 'root'
|
20
|
+
password: 'puppet'
|
21
|
+
|
22
|
+
steps:
|
23
|
+
|
24
|
+
- name: 'Remove the test files'
|
25
|
+
nodes: 'all'
|
26
|
+
set_plugin_defaults:
|
27
|
+
- plugins: '/^ssh/'
|
28
|
+
credential: 'linux_login'
|
29
|
+
command:
|
30
|
+
plugin: 'ssh/custom'
|
31
|
+
exec: 'rm'
|
32
|
+
arguments: '-rf /tmp/test1 /tmp/test2 /tmp/test3 /tmp/test4'
|
33
|
+
|
34
|
+
- name: 'Test correct escaping of command'
|
35
|
+
nodes: 'all'
|
36
|
+
command:
|
37
|
+
plugin: 'ssh/custom'
|
38
|
+
exec: 'echo'
|
39
|
+
arguments: '"${MYVAR}" > /tmp/test1'
|
40
|
+
env:
|
41
|
+
'MYVAR': 'MYVALUE'
|
42
|
+
base64: false
|
43
|
+
|
44
|
+
- name: 'Test correct escaping of command 2'
|
45
|
+
nodes: 'all'
|
46
|
+
command:
|
47
|
+
plugin: 'ssh/custom'
|
48
|
+
exec: 'echo'
|
49
|
+
arguments: '\"${MYVAR}\" > /tmp/test2'
|
50
|
+
env:
|
51
|
+
'MYVAR': 'MYVALUE'
|
52
|
+
base64: false
|
53
|
+
|
54
|
+
- name: 'Test command with base64'
|
55
|
+
nodes: 'all'
|
56
|
+
command:
|
57
|
+
plugin: 'ssh/custom'
|
58
|
+
exec: 'echo'
|
59
|
+
arguments: '"${MYVAR}" > /tmp/test3'
|
60
|
+
env:
|
61
|
+
'MYVAR': 'MYVALUE'
|
62
|
+
|
63
|
+
- name: 'Test command with base64 2'
|
64
|
+
nodes: 'all'
|
65
|
+
command:
|
66
|
+
plugin: 'ssh/custom'
|
67
|
+
exec: 'echo'
|
68
|
+
arguments: '\"${MYVAR}\" > /tmp/test4'
|
69
|
+
env:
|
70
|
+
'MYVAR': 'MYVALUE'
|
71
|
+
|
72
|
+
- name: 'Fail if contents of the files with the escape tests are wrong'
|
73
|
+
nodes: 'all'
|
74
|
+
command:
|
75
|
+
verify_commands:
|
76
|
+
- plugin: 'ssh/file_contains'
|
77
|
+
file: '/tmp/test1'
|
78
|
+
pattern: '^MYVALUE$'
|
79
|
+
- plugin: 'ssh/file_contains'
|
80
|
+
file: '/tmp/test2'
|
81
|
+
pattern: '^\"MYVALUE\"$'
|
82
|
+
plugin: 'ssh/custom'
|
83
|
+
exec: 'fail'
|
84
|
+
|
85
|
+
- name: 'Fail if contents of the files with the base64 tests are wrong'
|
86
|
+
nodes: 'all'
|
87
|
+
command:
|
88
|
+
verify_commands:
|
89
|
+
- plugin: 'ssh/file_contains'
|
90
|
+
file: '/tmp/test3'
|
91
|
+
pattern: '^MYVALUE$'
|
92
|
+
- plugin: 'ssh/file_contains'
|
93
|
+
file: '/tmp/test4'
|
94
|
+
pattern: '^\"MYVALUE\"$'
|
95
|
+
plugin: 'ssh/custom'
|
96
|
+
exec: 'fail'
|
97
|
+
|