beaker-puppet_install_helper 0.6.0 → 0.7.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 +8 -0
- data/README.md +1 -0
- data/beaker-puppet_install_helper.gemspec +1 -1
- data/lib/beaker/puppet_install_helper.rb +28 -2
- data/spec/unit/beaker/puppet_install_helper_spec.rb +40 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8131d15e7ced64bf1aa8ca7ea41f81364282778f
|
4
|
+
data.tar.gz: 56f041ee7891f7e5d35a50634ef6de2d75122267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a00f8327123a968bb98cb2fe4d313694a2d290841ebc0cc4d0cfaa80732190a288060d2949bf8b7d93fb359d3f4005eff2732e4e79d04dddba331e3b2da90ca
|
7
|
+
data.tar.gz: 5533d94d243a3f7d0dfc48528a63141aae8a6ca75add65f154627217102284628e470831e0ea444bd98cd7de7d940347445a937dfe3887ddd58d106b55080992
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.7.0]
|
8
|
+
### Changed
|
9
|
+
- MODULES-4653 `run_puppet_install_helper_on` now installs puppetserver on master role when using the `foss` install type.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Add puppet bin folder to $PATH on non-windows
|
13
|
+
|
7
14
|
## [0.6.0]
|
8
15
|
### Changed
|
9
16
|
- Change the default `PUPPET_INSTALL_TYPE` to `agent`
|
@@ -32,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
32
39
|
### Changed
|
33
40
|
- Add solaris for installing CA certs as well.
|
34
41
|
|
42
|
+
[0.7.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.6.0...0.7.0
|
35
43
|
[0.6.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.5.0...0.6.0
|
36
44
|
[0.5.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.4...0.5.0
|
37
45
|
[0.4.4]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.3...0.4.4
|
data/README.md
CHANGED
@@ -12,6 +12,7 @@ The way to use this is to declare either `run_puppet_install_helper()` or `run_p
|
|
12
12
|
- `PUPPET_INSTALL_TYPE=foss` will read `PUPPET_INSTALL_VERSION` and:
|
13
13
|
- if `PUPPET_INSTALL_VERSION` is less than 4 will attempt to install that version of the system package if available, or else the ruby gem of that version.
|
14
14
|
- if `PUPPET_INSTALL_VERSION` is 4 or more it will attempt to install the corresponding puppet-agent package, or gem version otherwise.
|
15
|
+
- if a `master` role is defined, will install puppetserver on that node. Note that the corresponding puppet-agent dependency will be installed on that node rather than the specified `PUPPET_INSTALL_VERSION`.
|
15
16
|
|
16
17
|
The best way is explicitly set `PUPPET_INSTALL_TYPE` and `PUPPET_INSTALL_VERSION` to what you want. It'll probably do what you expect.
|
17
18
|
|
@@ -51,8 +51,25 @@ module Beaker::PuppetInstallHelper
|
|
51
51
|
when 'foss'
|
52
52
|
opts = options.merge(version: version,
|
53
53
|
default_action: 'gem_install')
|
54
|
-
|
55
|
-
|
54
|
+
hosts.each do |host|
|
55
|
+
if hosts_with_role(hosts, 'master').length>0 then
|
56
|
+
next if host == master
|
57
|
+
end
|
58
|
+
install_puppet_on(host, opts)
|
59
|
+
end
|
60
|
+
if hosts_with_role(hosts, 'master').length>0 then
|
61
|
+
# install puppetserver
|
62
|
+
install_puppetlabs_release_repo( master, 'pc1' )
|
63
|
+
master.install_package('puppetserver')
|
64
|
+
on(master, puppet('resource', 'service', 'puppetserver', 'ensure=running'))
|
65
|
+
agents.each do |agent|
|
66
|
+
on(agent, puppet('resource', 'host', 'puppet', 'ensure=present', "ip=#{master.get_ip}"))
|
67
|
+
on(agent, puppet('agent', '--test'), :acceptable_exit_codes => [0,1])
|
68
|
+
end
|
69
|
+
master['distmoduledir'] = on(master, puppet('config', 'print', 'modulepath')).stdout.split(':')[0]
|
70
|
+
sign_certificate_for(agents)
|
71
|
+
run_agent_on(agents)
|
72
|
+
end
|
56
73
|
# XXX install_puppet_on() will only add_aio_defaults_on when the nodeset
|
57
74
|
# type == 'aio', but we don't want to depend on that.
|
58
75
|
if opts[:version] && !version_is_less(opts[:version], '4.0.0')
|
@@ -60,6 +77,9 @@ module Beaker::PuppetInstallHelper
|
|
60
77
|
add_puppet_paths_on(hosts)
|
61
78
|
end
|
62
79
|
Array(hosts).each do |host|
|
80
|
+
if hosts_with_role(hosts, 'master').length>0 then
|
81
|
+
next if host == master
|
82
|
+
end
|
63
83
|
if fact_on(host, 'osfamily') != 'windows'
|
64
84
|
on host, "mkdir -p #{host['distmoduledir']}"
|
65
85
|
# XXX Maybe this can just be removed? What PE/puppet version needs
|
@@ -88,6 +108,12 @@ module Beaker::PuppetInstallHelper
|
|
88
108
|
# nodeset type == 'aio', but we don't want to depend on that.
|
89
109
|
add_aio_defaults_on(hosts)
|
90
110
|
add_puppet_paths_on(hosts)
|
111
|
+
# beaker does not add the puppet bin folder to $PATH. this adds it for puppet 4
|
112
|
+
Array(hosts).each do |host|
|
113
|
+
if fact_on(host, 'osfamily') != 'windows'
|
114
|
+
on host, "echo 'export PATH=/opt/puppetlabs/puppet/bin:${PATH}' >> /root/.bashrc"
|
115
|
+
end
|
116
|
+
end
|
91
117
|
else
|
92
118
|
raise ArgumentError, "Type must be pe, foss, or agent; got #{type.inspect}"
|
93
119
|
end
|
@@ -10,10 +10,12 @@ describe 'Beaker::PuppetInstallHelper' do
|
|
10
10
|
allow(foss_host).to receive(:[]).with('distmoduledir').and_return('/dne')
|
11
11
|
allow(foss_host).to receive(:[]).with('platform').and_return('Debian')
|
12
12
|
allow(foss_host).to receive(:[]).with('pe_ver').and_return(nil)
|
13
|
+
allow(foss_host).to receive(:[]).with('roles').and_return(['agent'])
|
13
14
|
allow(foss_host).to receive(:puppet).and_return('hiera_config' => '/dne')
|
14
15
|
allow(pe_host).to receive(:[]).with('pe_ver').and_return('3.8.3')
|
15
16
|
allow(pe_host).to receive(:[]).with('distmoduledir').and_return('/dne')
|
16
17
|
allow(pe_host).to receive(:[]).with('platform').and_return('Debian')
|
18
|
+
allow(pe_host).to receive(:[]).with('roles').and_return(['agent'])
|
17
19
|
allow(pe_host).to receive(:puppet).and_return('hiera_config' => '/dne')
|
18
20
|
[foss_host, pe_host]
|
19
21
|
end
|
@@ -21,6 +23,7 @@ describe 'Beaker::PuppetInstallHelper' do
|
|
21
23
|
allow(subject).to receive(:options).and_return({})
|
22
24
|
allow(subject).to receive(:on)
|
23
25
|
allow(subject).to receive(:fact_on)
|
26
|
+
allow(subject).to receive(:agents).and_return(hosts)
|
24
27
|
end
|
25
28
|
after :each do
|
26
29
|
ENV.delete('PUPPET_VERSION')
|
@@ -71,22 +74,56 @@ describe 'Beaker::PuppetInstallHelper' do
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
context 'for foss' do
|
77
|
+
let :hosts do
|
78
|
+
foss_host = double(is_pe?: false)
|
79
|
+
foss_master = double(is_pe?: false)
|
80
|
+
allow(foss_host).to receive(:[]).with('distmoduledir').and_return('/dne')
|
81
|
+
allow(foss_host).to receive(:[]).with('platform').and_return('Debian')
|
82
|
+
allow(foss_host).to receive(:[]).with('pe_ver').and_return(nil)
|
83
|
+
allow(foss_host).to receive(:[]).with('roles').and_return(['agent'])
|
84
|
+
allow(foss_host).to receive(:puppet).and_return('hiera_config' => '/dne')
|
85
|
+
allow(foss_master).to receive(:[]).with('pe_ver').and_return(nil)
|
86
|
+
allow(foss_master).to receive(:[]=).with('distmoduledir', 'foo')
|
87
|
+
allow(foss_master).to receive(:[]).with('platform').and_return('Debian')
|
88
|
+
allow(foss_master).to receive(:[]).with('roles').and_return(['master'])
|
89
|
+
allow(foss_master).to receive(:get_ip).and_return('1.2.3.4')
|
90
|
+
allow(foss_master).to receive(:install_package).with('puppetserver')
|
91
|
+
allow(foss_master).to receive(:get_ip).and_return('1.2.3.4')
|
92
|
+
[foss_host, foss_master]
|
93
|
+
end
|
94
|
+
let :result do
|
95
|
+
Beaker::Result.new( nil, nil )
|
96
|
+
end
|
97
|
+
before :each do
|
98
|
+
allow(subject).to receive(:master).and_return(hosts[1])
|
99
|
+
allow(subject).to receive(:sign_certificate_for)
|
100
|
+
allow(subject).to receive(:puppet_agent)
|
101
|
+
allow(subject).to receive(:puppet).with('resource', 'service', 'puppetserver', 'ensure=running')
|
102
|
+
allow(subject).to receive(:puppet).with('resource', 'host', 'puppet', 'ensure=present', 'ip=1.2.3.4')
|
103
|
+
allow(subject).to receive(:puppet).with('agent', '--test')
|
104
|
+
allow(subject).to receive(:puppet).with('config', 'print', 'modulepath')
|
105
|
+
allow(subject).to receive(:on).and_return(result)
|
106
|
+
result.stdout = 'foo:bar'
|
107
|
+
end
|
74
108
|
it 'uses foss explicitly' do
|
75
109
|
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
76
|
-
expect(subject).to receive(:
|
110
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
|
111
|
+
expect(subject).to receive(:install_puppet_on).with(hosts[0], version: nil, default_action: 'gem_install')
|
77
112
|
subject.run_puppet_install_helper_on(hosts)
|
78
113
|
end
|
79
114
|
%w(PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
|
80
115
|
it 'uses foss with a version' do
|
81
116
|
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
82
117
|
ENV[version_var] = '3.8.1'
|
83
|
-
expect(subject).to receive(:
|
118
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
|
119
|
+
expect(subject).to receive(:install_puppet_on).with(hosts[0], version: '3.8.1', default_action: 'gem_install')
|
84
120
|
subject.run_puppet_install_helper_on(hosts)
|
85
121
|
end
|
86
122
|
it 'uses foss with a >4 version detects AIO' do
|
87
123
|
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
88
124
|
ENV[version_var] = '4.1.0'
|
89
|
-
expect(subject).to receive(:
|
125
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
|
126
|
+
expect(subject).to receive(:install_puppet_on).with(hosts[0], version: '4.1.0', default_action: 'gem_install')
|
90
127
|
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
91
128
|
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
92
129
|
subject.run_puppet_install_helper_on(hosts)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-puppet_install_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|