beaker-task_helper 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -0
- data/lib/beaker/task_helper/version.rb +1 -1
- data/lib/beaker/task_helper.rb +25 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aa5e71c49d4a2414c546b7253e9ad625b03cb4b
|
4
|
+
data.tar.gz: 24db4ac16d07dd157b07832c48c5e3f274b2977c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2e75f30b9defb8407b9dfde6fd5a5c20c57a9d36086adc97754924713aaa61c2995b31f5e4ddec40ea1145121828d3972ffd6b545bfeb42b621146a681d06b3
|
7
|
+
data.tar.gz: cb41ff126ae70ae7b7c9b3c60dab8367ed5ad8ed37f5c5aaa25fb1e7e54470d1e0e63a1de1eb93a2337f9bbc3c93c1aeb8f3824494e3f12ee2c33e62a02683c6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/beaker/task_helper.rb
CHANGED
@@ -8,10 +8,10 @@ module Beaker::TaskHelper # rubocop:disable Style/ClassAndModuleChildren
|
|
8
8
|
(on default, puppet('--version')).output.chomp
|
9
9
|
end
|
10
10
|
|
11
|
-
DEFAULT_PASSWORD = if
|
11
|
+
DEFAULT_PASSWORD = if ENV.has_key?('BEAKER_password')
|
12
|
+
ENV['BEAKER_password']
|
13
|
+
elsif default[:hypervisor] == 'vagrant'
|
12
14
|
'puppet'
|
13
|
-
elsif default[:hypervisor] == 'vcloud' || default[:hypervisor] == 'vmpooler'
|
14
|
-
'Qu@lity!'
|
15
15
|
else
|
16
16
|
'root'
|
17
17
|
end
|
@@ -25,7 +25,6 @@ module Beaker::TaskHelper # rubocop:disable Style/ClassAndModuleChildren
|
|
25
25
|
elsif default[:docker_image_commands].to_s.include? 'apt-get'
|
26
26
|
on(hosts, 'apt-get install -y make gcc ruby-dev', acceptable_exit_codes: [0, 1]).stdout
|
27
27
|
end
|
28
|
-
|
29
28
|
end
|
30
29
|
|
31
30
|
Array(hosts).each do |host|
|
@@ -51,10 +50,11 @@ INSTALL_BOLT_PP
|
|
51
50
|
def run_task(task_name:, params: nil, password: DEFAULT_PASSWORD, host: nil, format: 'human')
|
52
51
|
output = if pe_install?
|
53
52
|
host = master.hostname if host.nil?
|
54
|
-
run_puppet_task(task_name: task_name, params: params, host: host)
|
53
|
+
run_puppet_task(task_name: task_name, params: params, host: host, format: format)
|
55
54
|
else
|
56
55
|
host = 'localhost' if host.nil?
|
57
|
-
run_bolt_task(task_name: task_name, params: params,
|
56
|
+
run_bolt_task(task_name: task_name, params: params,
|
57
|
+
password: password, host: host, format: format)
|
58
58
|
end
|
59
59
|
|
60
60
|
if format == 'json'
|
@@ -65,22 +65,31 @@ INSTALL_BOLT_PP
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
def run_bolt_task(task_name:, params: nil, password: DEFAULT_PASSWORD,
|
68
|
+
def run_bolt_task(task_name:, params: nil, password: DEFAULT_PASSWORD,
|
69
|
+
host: 'localhost', format: 'human')
|
69
70
|
if fact_on(default, 'osfamily') == 'windows'
|
70
71
|
bolt_path = '/cygdrive/c/Program\ Files/Puppet\ Labs/Puppet/sys/ruby/bin/bolt.bat'
|
71
72
|
module_path = 'C:/ProgramData/PuppetLabs/code/modules'
|
73
|
+
|
74
|
+
if Puppet::Util::Package.versioncmp(BOLT_VERSION, '0.15.0') > 0
|
75
|
+
check = '--no-ssl'
|
76
|
+
else
|
77
|
+
check = '--insecure'
|
78
|
+
end
|
72
79
|
else
|
73
80
|
bolt_path = '/opt/puppetlabs/puppet/bin/bolt'
|
74
81
|
module_path = '/etc/puppetlabs/code/modules'
|
75
|
-
end
|
76
82
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
83
|
+
if Puppet::Util::Package.versioncmp(BOLT_VERSION, '0.15.0') > 0
|
84
|
+
check = '--no-host-key-check'
|
85
|
+
else
|
86
|
+
check = '--insecure'
|
87
|
+
end
|
81
88
|
end
|
82
89
|
|
83
|
-
bolt_full_cli = "#{bolt_path} task run #{task_name} #{check} -m #{module_path}
|
90
|
+
bolt_full_cli = "#{bolt_path} task run #{task_name} #{check} -m #{module_path} " \
|
91
|
+
"--nodes #{host} --password #{password}"
|
92
|
+
bolt_full_cli << " --format #{format}" if format != 'human'
|
84
93
|
bolt_full_cli << if params.class == Hash
|
85
94
|
" --params '#{params.to_json}'"
|
86
95
|
else
|
@@ -91,7 +100,7 @@ INSTALL_BOLT_PP
|
|
91
100
|
bolt_full_cli << ' --transport winrm --user Administrator'
|
92
101
|
end
|
93
102
|
puts "BOLT_CLI: #{bolt_full_cli}" if ENV['BEAKER_debug']
|
94
|
-
on(default, bolt_full_cli, acceptable_exit_codes: [0, 1]).stdout
|
103
|
+
on(default, bolt_full_cli, acceptable_exit_codes: [0, 1, 2]).stdout
|
95
104
|
end
|
96
105
|
|
97
106
|
def run_puppet_task(task_name:, params: nil, host: 'localhost', format: 'human')
|
@@ -102,9 +111,9 @@ INSTALL_BOLT_PP
|
|
102
111
|
else
|
103
112
|
args << params
|
104
113
|
end
|
105
|
-
if format
|
114
|
+
if format != 'human'
|
106
115
|
args << '--format'
|
107
|
-
args <<
|
116
|
+
args << format
|
108
117
|
end
|
109
118
|
on(master, puppet(*args), acceptable_exit_codes: [0, 1]).stdout
|
110
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-task_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.6.
|
138
|
+
rubygems_version: 2.6.14
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Ruby gem to help testing tasks with Beaker
|