beaker-puppet_install_helper 0.7.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8b427a76ae0d653988c28f41405dcd28c741028
4
- data.tar.gz: 0d158cf962f91151a189f576b5f7b49020b03aa4
3
+ metadata.gz: 4671087136928e9adda784a24f1ea5577e5b6b68
4
+ data.tar.gz: 5f785c6f41fd90a0a7b0c578b321910c5fec3c77
5
5
  SHA512:
6
- metadata.gz: 615e51ff6f078ee5b122dcf810b6e800f79bc08358f19928bfed8be0f59e5dae2f39d55fbdbeac256965bb0bb83b70b0857182c95d19ccbeb57d9ffeb6445285
7
- data.tar.gz: 738c89b9f4d17d4f357447a710b8134917dde093ddff4027723e9d89d6751a5641887fa39fa679cdcc4beba80b1e58145b3794d49a6547c822157f189719b985
6
+ metadata.gz: cc2780d965a5f86cf072b373bf3b9da60cae36dd123a84b3b06fed1b9cd60e607fa10d81fa1387a041988409e2b69e6ada775ec984ad81ce1da74df8e7789f73
7
+ data.tar.gz: f898be72b22bfbaa300370cd3df8f7eaeb4d60377a45404a938bfb97c55f69cbfcb4f8474e777349f9070fb95e5d4c28d44ad96b9e06dd8d85712a68ed6857c3
data/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ 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.9.0]
8
+ ### Changed
9
+ - Use `BEAKER_IS_PE` instead of `PUPPET_INSTALL_TYPE` to specify whether a run should be PE or agent.
10
+ - Use `BEAKER_PUPPET_COLLECTION` instead of `PUPPET_INSTALL_TYPE` to specify puppet5, puppet6-nightly, etc. collections.
11
+ - Use `BEAKER_PUPPET_AGENT_VERSION` instead of `PUPPET_INSTALL_VERSION`
12
+ - Use `BEAKER_PUPPET_AGENT_SHA` instead of `PUPPET_AGENT_SHA`
13
+
14
+ ### Fixed
15
+ - Beaker only cares about the SHA and no longer cares about `PUPPET_AGENT_SUITE_VERSION` so deprecating that variable. See (the beaker source)[https://github.com/puppetlabs/beaker-puppet/blob/63ea32a0d7caa8f261c533b020625de19569f971/lib/beaker-puppet/install_utils/foss_utils.rb#L1150-L1152]
16
+
17
+ ## [0.8.0]
18
+ ### Changed
19
+ - Changed the default `PUPPET_INSTALL_TYPE` from "agent" (puppet 4) to "puppet5"
20
+
21
+ ### Added
22
+ - Added puppet5 and puppet6-nightly ability.
23
+
7
24
  ## [0.7.1]
8
25
  ### Fixed
9
26
  - Reverted adding the bin folder to $PATH on non-windows
@@ -43,6 +60,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
43
60
  ### Changed
44
61
  - Add solaris for installing CA certs as well.
45
62
 
63
+ [0.8.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.7.1...0.8.0
46
64
  [0.7.1]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.7.0...0.7.1
47
65
  [0.7.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.6.0...0.7.0
48
66
  [0.6.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.5.0...0.6.0
data/README.md CHANGED
@@ -4,24 +4,15 @@ This gem is simply an abstraction for the various ways that we install puppet fr
4
4
 
5
5
  ### `run_puppet_install_helper`
6
6
 
7
- The way to use this is to declare either `run_puppet_install_helper()` or `run_puppet_install_helper_on(hosts)` and set environment variables `PUPPET_INSTALL_VERSION` and/or `PUPPET_INSTALL_TYPE` in the following combinations to have puppet installed on the desired hosts:
7
+ The way to use this is to declare either `run_puppet_install_helper()` or `run_puppet_install_helper_on(hosts)` and set environment variables `BEAKER_PUPPET_AGENT_VERSION` and/or `BEAKER_PUPPET_COLLECTION` in the following combinations to have puppet installed on the desired hosts. The nodeset should be configured with `type: pe` or `type: aio` to control the type of install.
8
8
 
9
- - `PUPPET_INSTALL_TYPE` is unset: if `type: pe` is set for the default node in the nodeset, it will us the PE install method. Otherwise it will only install an agent.
10
- - `PUPPET_INSTALL_TYPE=pe` will read `PUPPET_INSTALL_VERSION` and attempt to install that version of the PE tarball. If no version is set, then it uses the latest stable build.
11
- - `PUPPET_INSTALL_TYPE=agent` will read `PUPPET_INSTALL_VERSION` and install that version of puppet-agent (eg, `PUPPET_INSTALL_TYPE=agent PUPPET_INSTALL_VERSION=1.0.0`)
12
- - `PUPPET_INSTALL_TYPE=foss` will read `PUPPET_INSTALL_VERSION` and:
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
- - 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`.
9
+ - `BEAKER_PUPPET_COLLECTION=<puppet collection>` will install the specified `BEAKER_PUPPET_AGENT_VERSION` from the specified collection. Valid values are `pc1`, `puppet5`, `puppet6-nightly` etc. This may change with time.
10
+ - `BEAKER_PUPPET_AGENT_VERSION=<version>` to specify
11
+ - `BEAKER_IS_PE=<yes or no>` may be used to force a nodeset to be PE or not, regardless of the nodeset `type` or absence thereof.
12
+ - `BEAKER_PUPPET_AGENT_SHA=<sha>` may be used in order to use a development puppet-agent package.
13
+ - `PUPPET_INSTALL_TYPE=foss` may be used to install foss puppet 3.x, but is deprecated and should not be used.
16
14
 
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.
18
-
19
- #### Installing a puppet-agent package from a development repository
20
-
21
- In order to use a custom, or unreleased, puppet-agent package set the following environment variables"
22
- - `PUPPET_INSTALL_TYPE=agent`
23
- - `PUPPET_AGENT_SHA` is the longform commit SHA used when building the puppet-agent package, for example `PUPPET_AGENT_SHA=18d31fd5ed41abb276398201f84a4347e0fc7092`. This is required to be set in order to use a development puppet-agent package
24
- - `PUPPET_AGENT_SUITE_VERSION` is the version of the puppet-agent package, for example `PUPPET_AGENT_SUITE_VERSION="1.8.2.350.g18d31fd`. This is optional, and will default to `PUPPET_AGENT_SHA` if not set
15
+ The best way is explicitly set `BEAKER_PUPPET_COLLECTION` and `BEAKER_PUPPET_AGENT_VERSION` to what you want. It'll probably do what you expect.
25
16
 
26
17
  ### `install_ca_certs`
27
18
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'beaker-puppet_install_helper'
3
- s.version = '0.7.1'
3
+ s.version = '0.9.0'
4
4
  s.authors = ['Puppetlabs']
5
5
  s.email = ['hunter@puppet.com']
6
6
  s.homepage = 'https://github.com/puppetlabs/beaker-puppet_install_helper'
@@ -7,36 +7,21 @@ module Beaker::PuppetInstallHelper
7
7
  end
8
8
 
9
9
  # Takes a host(s) object, install type string, and install version string.
10
- # - Type defaults to PE for PE nodes, and foss otherwise.
11
- # - Version will default to the latest 3x foss/pe package, depending on type
12
10
  def run_puppet_install_helper_on(hosts, type_arg = find_install_type, version = find_install_version)
13
11
  type = type_arg || find_install_type
14
12
 
15
13
  # Short circuit based on rspec-system and beaker variables
16
14
  if (ENV['RS_PROVISION'] == 'no') || (ENV['BEAKER_provision'] == 'no')
17
- Array(hosts).each do |host|
18
- case type
19
- when 'pe'
20
- configure_pe_defaults_on(host)
21
- when /foss|agent/
22
- configure_foss_defaults_on(host)
23
- end
24
- end
15
+ configure_type_defaults_on(hosts)
25
16
  return
26
17
  end
27
18
 
28
19
  # Example environment variables to be read:
29
- # PUPPET_INSTALL_VERSION=3.8.1 <-- for foss/pe/gem
30
- # PUPPET_INSTALL_VERSION=4.1.0 <-- for agent/gem
31
- # PUPPET_INSTALL_VERSION=1.0.1 <-- for agent
32
- #
33
- # PUPPET_INSTALL_TYPE=pe
34
- # PUPPET_INSTALL_TYPE=foss
35
- # PUPPET_INSTALL_TYPE=agent
36
-
37
- # For PUPPET_INSTALL_TYPE=agent and using a development version of Puppet Agent
38
- # PUPPET_AGENT_SHA=18d31fd5ed41abb276398201f84a4347e0fc7092 <-- Required. Long form commit SHA used to build the Puppet Agent
39
- # PUPPET_AGENT_SUITE_VERSION=1.8.2.350.g18d31fd <-- Optiona. Version string for the Puppet Agent
20
+ # BEAKER_PUPPET_COLLECTION=pc1 <-- for latest 4.x
21
+ # BEAKER_PUPPET_COLLECTION=puppet5 <-- for latest 5.x
22
+ # BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_PUPPET_AGENT_VERSION=5.3.1 <-- for specific version
23
+ # BEAKER_PUPPET_COLLECTION=puppet6-nightly <-- for latest nightly build
24
+ # BEAKER_PUPPET_AGENT_SHA=0ed2bbc918326263da9d97d0361a9e9303b52938 <-- for specific dev build
40
25
 
41
26
  # Ensure windows 2003 is always set to 32 bit
42
27
  Array(hosts).each do |host|
@@ -55,9 +40,12 @@ module Beaker::PuppetInstallHelper
55
40
  if hosts_with_role(hosts, 'master').length>0 then
56
41
  next if host == master
57
42
  end
43
+ # XXX install_puppet_on() will call install_puppet_agent_on() if there
44
+ # is a :version option >= 4.x passed, but does foss by default.
58
45
  install_puppet_on(host, opts)
59
46
  end
60
47
  if hosts_with_role(hosts, 'master').length>0 then
48
+ # TODO Make the puppetserver code work with puppet5/puppet6
61
49
  # install puppetserver
62
50
  install_puppetlabs_release_repo( master, 'pc1' )
63
51
  master.install_package('puppetserver')
@@ -94,13 +82,11 @@ module Beaker::PuppetInstallHelper
94
82
  end
95
83
  end
96
84
  when 'agent'
97
- if ENV['PUPPET_AGENT_SHA'].nil?
98
- # This will fail on hosts that are not supported; use foss and specify a 4.x version instead
85
+ if find_agent_sha.nil?
99
86
  install_puppet_agent_on(hosts, options.merge(version: version))
100
87
  else
101
- opts = options.merge(puppet_collection: 'PC1',
102
- puppet_agent_sha: ENV['PUPPET_AGENT_SHA'],
103
- puppet_agent_version: ENV['PUPPET_AGENT_SUITE_VERSION'] || ENV['PUPPET_AGENT_SHA'])
88
+ opts = options.merge(puppet_agent_sha: find_agent_sha,
89
+ puppet_agent_version: ENV['PUPPET_AGENT_SUITE_VERSION'] || find_agent_sha)
104
90
  install_puppet_agent_dev_repo_on(hosts, opts)
105
91
  end
106
92
 
@@ -114,6 +100,7 @@ module Beaker::PuppetInstallHelper
114
100
  end
115
101
 
116
102
  def find_install_type
103
+ # XXX Just use default.is_pe? when PUPPET_INSTALL_TYPE=foss is removed.
117
104
  ENV['PUPPET_INSTALL_TYPE'] || if default.is_pe?
118
105
  'pe'
119
106
  else
@@ -121,8 +108,12 @@ module Beaker::PuppetInstallHelper
121
108
  end
122
109
  end
123
110
 
111
+ def find_agent_sha
112
+ ENV['BEAKER_PUPPET_AGENT_SHA'] || ENV['PUPPET_AGENT_SHA']
113
+ end
114
+
124
115
  def find_install_version
125
- ENV['PUPPET_INSTALL_VERSION'] || ENV['PUPPET_VERSION']
116
+ ENV['BEAKER_PUPPET_AGENT_VERSION'] || ENV['PUPPET_INSTALL_VERSION'] || ENV['PUPPET_VERSION']
126
117
  end
127
118
  end
128
119
 
@@ -24,6 +24,7 @@ describe 'Beaker::PuppetInstallHelper' do
24
24
  allow(subject).to receive(:on)
25
25
  allow(subject).to receive(:fact_on)
26
26
  allow(subject).to receive(:agents).and_return(hosts)
27
+ allow(subject).to receive(:default).and_return(hosts[0])
27
28
  end
28
29
  after :each do
29
30
  ENV.delete('PUPPET_VERSION')
@@ -31,17 +32,20 @@ describe 'Beaker::PuppetInstallHelper' do
31
32
  ENV.delete('PUPPET_INSTALL_TYPE')
32
33
  ENV.delete('PUPPET_AGENT_SHA')
33
34
  ENV.delete('PUPPET_AGENT_SUITE_VERSION')
35
+ ENV.delete('BEAKER_IS_PE')
36
+ ENV.delete('BEAKER_PUPPET_COLLECTION')
37
+ ENV.delete('BEAKER_PUPPET_AGENT_VERSION')
38
+ ENV.delete('BEAKER_PUPPET_AGENT_SHA')
34
39
  end
35
40
  describe '#run_puppet_install_helper' do
36
41
  before :each do
37
42
  allow(subject).to receive(:hosts).and_return(hosts)
38
- allow(subject).to receive(:default).and_return(hosts[0])
39
43
  end
40
44
  it 'calls run_puppet_install_helper_on on each host' do
41
45
  expect(subject).to receive(:run_puppet_install_helper_on).with(hosts, 'agent', nil)
42
46
  subject.run_puppet_install_helper
43
47
  end
44
- %w(PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
48
+ %w(BEAKER_PUPPET_AGENT_VERSION PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
45
49
  it 'calls run_puppet_install_helper_on on each host with a version ' do
46
50
  ENV[version_var] = '4.1.0'
47
51
  expect(subject).to receive(:run_puppet_install_helper_on).with(hosts, 'agent', '4.1.0')
@@ -73,64 +77,125 @@ describe 'Beaker::PuppetInstallHelper' do
73
77
  subject.run_puppet_install_helper_on(hosts)
74
78
  end
75
79
  end
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
108
- it 'uses foss explicitly' do
109
- ENV['PUPPET_INSTALL_TYPE'] = 'foss'
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')
112
- subject.run_puppet_install_helper_on(hosts)
113
- end
114
- %w(PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
115
- it 'uses foss with a version' do
116
- ENV['PUPPET_INSTALL_TYPE'] = 'foss'
117
- ENV[version_var] = '3.8.1'
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')
120
- subject.run_puppet_install_helper_on(hosts)
80
+ context 'for non-pe' do
81
+ context 'and foss type' do
82
+ let :hosts do
83
+ foss_host = double(is_pe?: false)
84
+ foss_master = double(is_pe?: false)
85
+ allow(foss_host).to receive(:[]).with('distmoduledir').and_return('/dne')
86
+ allow(foss_host).to receive(:[]).with('platform').and_return('Debian')
87
+ allow(foss_host).to receive(:[]).with('pe_ver').and_return(nil)
88
+ allow(foss_host).to receive(:[]).with('roles').and_return(['agent'])
89
+ allow(foss_host).to receive(:puppet).and_return('hiera_config' => '/dne')
90
+ allow(foss_master).to receive(:[]).with('pe_ver').and_return(nil)
91
+ allow(foss_master).to receive(:[]=).with('distmoduledir', 'foo')
92
+ allow(foss_master).to receive(:[]).with('platform').and_return('Debian')
93
+ allow(foss_master).to receive(:[]).with('roles').and_return(['master'])
94
+ allow(foss_master).to receive(:get_ip).and_return('1.2.3.4')
95
+ allow(foss_master).to receive(:install_package).with('puppetserver')
96
+ allow(foss_master).to receive(:get_ip).and_return('1.2.3.4')
97
+ [foss_host, foss_master]
98
+ end
99
+ let :result do
100
+ Beaker::Result.new( nil, nil )
101
+ end
102
+ before :each do
103
+ allow(subject).to receive(:master).and_return(hosts[1])
104
+ allow(subject).to receive(:sign_certificate_for)
105
+ allow(subject).to receive(:puppet_agent)
106
+ allow(subject).to receive(:puppet).with('resource', 'service', 'puppetserver', 'ensure=running')
107
+ allow(subject).to receive(:puppet).with('resource', 'host', 'puppet', 'ensure=present', 'ip=1.2.3.4')
108
+ allow(subject).to receive(:puppet).with('agent', '--test')
109
+ allow(subject).to receive(:puppet).with('config', 'print', 'modulepath')
110
+ allow(subject).to receive(:on).and_return(result)
111
+ result.stdout = 'foo:bar'
121
112
  end
122
- it 'uses foss with a >4 version detects AIO' do
113
+ it 'uses foss explicitly' do
123
114
  ENV['PUPPET_INSTALL_TYPE'] = 'foss'
124
- ENV[version_var] = '4.1.0'
125
115
  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')
127
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
128
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
116
+ expect(subject).to receive(:install_puppet_on).with(hosts[0], version: nil, default_action: 'gem_install')
129
117
  subject.run_puppet_install_helper_on(hosts)
130
118
  end
119
+ %w(BEAKER_PUPPET_AGENT_VERSION PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
120
+ it 'uses foss with a version' do
121
+ ENV['PUPPET_INSTALL_TYPE'] = 'foss'
122
+ ENV[version_var] = '3.8.1'
123
+ expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
124
+ expect(subject).to receive(:install_puppet_on).with(hosts[0], version: '3.8.1', default_action: 'gem_install')
125
+ subject.run_puppet_install_helper_on(hosts)
126
+ end
127
+ it 'uses foss with a 4.x version detects AIO' do
128
+ ENV['PUPPET_INSTALL_TYPE'] = 'foss'
129
+ ENV[version_var] = '4.1.0'
130
+ expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
131
+ expect(subject).to receive(:install_puppet_on).with(hosts[0], version: '4.1.0', default_action: 'gem_install')
132
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
133
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
134
+ subject.run_puppet_install_helper_on(hosts)
135
+ end
136
+ it 'uses pc1 with a 5.x version; this fails' do
137
+ ENV['PUPPET_INSTALL_TYPE'] = 'foss'
138
+ ENV[version_var] = '5.1.0'
139
+ expect(subject).to receive(:install_puppetlabs_release_repo).with(hosts[1], 'pc1')
140
+ expect(subject).to receive(:install_puppet_on).with(hosts[0], version: '5.1.0', default_action: 'gem_install')
141
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
142
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
143
+ subject.run_puppet_install_helper_on(hosts)
144
+ end
145
+ end
146
+ end
147
+ context 'for agent type' do
148
+ context 'with no collection' do
149
+ it 'uses agent by default for non-pe hosts' do
150
+ expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
151
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
152
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
153
+ subject.run_puppet_install_helper_on(hosts)
154
+ end
155
+ it 'uses agent explicitly' do
156
+ ENV['PUPPET_INSTALL_TYPE'] = 'agent'
157
+ expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
158
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
159
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
160
+ subject.run_puppet_install_helper_on(hosts)
161
+ end
162
+ end
163
+ ['puppet5', 'puppet6-nightly'].each do |collection|
164
+ context "with #{collection} collection" do
165
+ it "installs puppet-agent from #{collection} repo" do
166
+ ENV['BEAKER_PUPPET_COLLECTION'] = collection
167
+ expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
168
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
169
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
170
+ subject.run_puppet_install_helper_on(hosts)
171
+ end
172
+ end
173
+ end
174
+ context 'with a specific development sha' do
175
+ it 'uses a development repo' do
176
+ ENV['BEAKER_PUPPET_AGENT_SHA'] = '0ed2bbc918326263da9d97d0361a9e9303b52938'
177
+ expect(subject).to receive(:install_puppet_agent_dev_repo_on).with(hosts, puppet_agent_sha: '0ed2bbc918326263da9d97d0361a9e9303b52938', puppet_agent_version: '0ed2bbc918326263da9d97d0361a9e9303b52938')
178
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
179
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
180
+ subject.run_puppet_install_helper_on(hosts)
181
+ end
182
+ it 'uses a development repo with suite version and sha' do
183
+ ENV['BEAKER_PUPPET_AGENT_SHA'] = '0ed2bbc918326263da9d97d0361a9e9303b52938'
184
+ ENV['PUPPET_AGENT_SUITE_VERSION'] = '5.5.0.152.g0ed2bbc'
185
+ expect(subject).to receive(:install_puppet_agent_dev_repo_on).with(hosts, puppet_agent_sha: '0ed2bbc918326263da9d97d0361a9e9303b52938', puppet_agent_version: '5.5.0.152.g0ed2bbc')
186
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
187
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
188
+ subject.run_puppet_install_helper_on(hosts)
189
+ end
190
+ end
131
191
  end
132
192
  end
133
193
  context 'for PE' do
194
+ it 'uses PE when default is a pe host' do
195
+ expect(subject).to receive(:default).and_return(hosts[1])
196
+ expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => nil)
197
+ subject.run_puppet_install_helper_on(hosts)
198
+ end
134
199
  it 'uses PE explicitly' do
135
200
  ENV['PUPPET_INSTALL_TYPE'] = 'pe'
136
201
  expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => nil)
@@ -153,41 +218,5 @@ describe 'Beaker::PuppetInstallHelper' do
153
218
  subject.run_puppet_install_helper_on(hosts)
154
219
  end
155
220
  end
156
- context 'for puppet-agent' do
157
- it 'uses agent explicitly' do
158
- ENV['PUPPET_INSTALL_TYPE'] = 'agent'
159
- expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
160
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
161
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
162
- subject.run_puppet_install_helper_on(hosts)
163
- end
164
- it 'uses foss with a version' do
165
- ENV['PUPPET_INSTALL_TYPE'] = 'agent'
166
- ENV['PUPPET_INSTALL_VERSION'] = '1.1.0'
167
- expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: '1.1.0')
168
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
169
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
170
- subject.run_puppet_install_helper_on(hosts)
171
- end
172
- end
173
- context 'for puppet-agent development repo' do
174
- before :each do
175
- ENV['PUPPET_INSTALL_TYPE'] = 'agent'
176
- ENV['PUPPET_AGENT_SHA'] = 'abc123'
177
- end
178
- it 'uses a development repo' do
179
- expect(subject).to receive(:install_puppet_agent_dev_repo_on).with(hosts, puppet_collection: 'PC1', puppet_agent_sha: 'abc123', puppet_agent_version: 'abc123')
180
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
181
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
182
- subject.run_puppet_install_helper_on(hosts)
183
- end
184
- it 'uses a development repo with suite version' do
185
- ENV['PUPPET_AGENT_SUITE_VERSION'] = '1.0.0.0.gabc123'
186
- expect(subject).to receive(:install_puppet_agent_dev_repo_on).with(hosts, puppet_collection: 'PC1', puppet_agent_sha: 'abc123', puppet_agent_version: '1.0.0.0.gabc123')
187
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
188
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
189
- subject.run_puppet_install_helper_on(hosts)
190
- end
191
- end
192
221
  end
193
222
  end
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.7.1
4
+ version: 0.9.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-04-13 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.5.1
84
+ rubygems_version: 2.6.14
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Puppet install helper for Beaker