beaker-puppet_install_helper 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +41 -0
- data/Gemfile +15 -3
- data/MAINTAINERS +15 -0
- data/README.md +9 -2
- data/Rakefile +15 -0
- data/beaker-puppet_install_helper.gemspec +9 -10
- data/lib/beaker/ca_cert_helper.rb +1 -4
- data/lib/beaker/puppet_install_helper.rb +38 -39
- data/spec/unit/beaker/ca_cert_helper_spec.rb +14 -14
- data/spec/unit/beaker/puppet_install_helper_spec.rb +86 -63
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3ab1391c840c72e0a1e79bf939dcbfbdf58869a
|
4
|
+
data.tar.gz: f4c3d416e7647511608663e7e3fe84540eee0ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21987dff0ba3291aa3a1e81cc5a94e076ba08c62c387ba0ac5c4fea2cc5484719d7489c3ae3b881a4d519cf1f1758b3847fba5df0c6d8f5c8e839b93cda02000
|
7
|
+
data.tar.gz: 8b6c6cd2b7c4d31e6853a8f0454990bb3d56166e6261297e28b76a79d745f5d05b0098e4014b2f72f3b99f5c77c3dc3c3a312429d1e00c06367021a6ea0c624e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
|
+
|
7
|
+
## [0.6.0]
|
8
|
+
### Changed
|
9
|
+
- Change the default `PUPPET_INSTALL_TYPE` to `agent`
|
10
|
+
|
11
|
+
## [0.5.0]
|
12
|
+
### Changed
|
13
|
+
- Bump the beaker dependency range up to allow for beaker 3.
|
14
|
+
|
15
|
+
## [0.4.4]
|
16
|
+
### Fixed
|
17
|
+
- Always add certs on windows
|
18
|
+
|
19
|
+
## [0.4.3]
|
20
|
+
### Fixed
|
21
|
+
- Use pe\_ver for the host variable of version to install
|
22
|
+
|
23
|
+
## [0.4.2]
|
24
|
+
### Fixed
|
25
|
+
- Re-add CA certs on windows and solaris for PE 3.
|
26
|
+
|
27
|
+
## [0.4.1]
|
28
|
+
### Fixed
|
29
|
+
- Don't copy certs on solaris, as they are no longer needed
|
30
|
+
|
31
|
+
## [0.4.0]
|
32
|
+
### Changed
|
33
|
+
- Add solaris for installing CA certs as well.
|
34
|
+
|
35
|
+
[0.6.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.5.0...0.6.0
|
36
|
+
[0.5.0]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.4...0.5.0
|
37
|
+
[0.4.4]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.3...0.4.4
|
38
|
+
[0.4.3]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.2...0.4.3
|
39
|
+
[0.4.2]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.1...0.4.2
|
40
|
+
[0.4.1]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.4.0...0.4.1
|
41
|
+
[0.4.2]: https://github.com/puppetlabs/beaker-puppet_install_helper/compare/0.3.1...0.4.0
|
data/Gemfile
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
-
source ENV['GEM_SOURCE'] ||
|
1
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
group :test do
|
6
|
+
gem 'beaker', '= 2.52.0' if RUBY_VERSION <= '2.1.6'
|
7
|
+
gem 'beaker' if RUBY_VERSION > '2.1.6'
|
8
|
+
gem 'bundler', '~> 1.9'
|
9
|
+
gem 'rake', '~> 10.0'
|
10
|
+
gem 'rspec', '~> 3'
|
11
|
+
gem 'rubocop', require: false
|
12
|
+
gem 'rubocop-rspec', require: false
|
7
13
|
end
|
8
14
|
|
15
|
+
group :development do
|
16
|
+
gem 'pry'
|
17
|
+
gem 'pry-byebug'
|
18
|
+
end
|
19
|
+
|
20
|
+
eval(File.read("#{__FILE__}.local"), binding) if File.exist? "#{__FILE__}.local"
|
data/MAINTAINERS
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"version": 1,
|
3
|
+
"file_format": "This MAINTAINERS file format is described at http://pup.pt/maintainers",
|
4
|
+
"issues": "https://github.com/puppetlabs/beaker-puppet_install_helper/issues",
|
5
|
+
"people": [
|
6
|
+
{
|
7
|
+
"github": "hunner",
|
8
|
+
"name": "Hunter Haugen"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"github": "DavidS",
|
12
|
+
"name": "David Schmitt"
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
data/README.md
CHANGED
@@ -6,15 +6,22 @@ This gem is simply an abstraction for the various ways that we install puppet fr
|
|
6
6
|
|
7
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:
|
8
8
|
|
9
|
-
- `PUPPET_INSTALL_TYPE` is unset:
|
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
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`)
|
11
12
|
- `PUPPET_INSTALL_TYPE=foss` will read `PUPPET_INSTALL_VERSION` and:
|
12
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.
|
13
14
|
- if `PUPPET_INSTALL_VERSION` is 4 or more it will attempt to install the corresponding puppet-agent package, or gem version otherwise.
|
14
|
-
- `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`)
|
15
15
|
|
16
16
|
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
17
|
|
18
|
+
#### Installing a puppet-agent package from a development repository
|
19
|
+
|
20
|
+
In order to use a custom, or unreleased, puppet-agent package set the following environment variables"
|
21
|
+
- `PUPPET_INSTALL_TYPE=agent`
|
22
|
+
- `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
|
23
|
+
- `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
|
24
|
+
|
18
25
|
### `install_ca_certs`
|
19
26
|
|
20
27
|
Install Certificate Authority Certs on Windows and OSX for Geotrust, User Trust Network, and Equifax
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
task default: [:lint, :spec]
|
3
|
+
|
4
|
+
require 'rubocop/rake_task'
|
5
|
+
desc 'Run rubocop'
|
6
|
+
RuboCop::RakeTask.new(:lint) do |t|
|
7
|
+
t.requires << 'rubocop-rspec'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
desc 'Run spec tests using rspec'
|
12
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
13
|
+
t.rspec_opts = ['--color']
|
14
|
+
t.pattern = 'spec'
|
15
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.name =
|
3
|
-
s.version = '0.
|
4
|
-
s.authors = [
|
5
|
-
s.email = [
|
6
|
-
s.homepage =
|
7
|
-
s.summary =
|
8
|
-
s.description =
|
2
|
+
s.name = 'beaker-puppet_install_helper'
|
3
|
+
s.version = '0.6.0'
|
4
|
+
s.authors = ['Puppetlabs']
|
5
|
+
s.email = ['hunter@puppet.com']
|
6
|
+
s.homepage = 'https://github.com/puppetlabs/beaker-puppet_install_helper'
|
7
|
+
s.summary = 'Puppet install helper for Beaker'
|
8
|
+
s.description = 'Provides a unified external interface to choosing which version of puppet to install on the systems under test. For details on Beaker, see https://github.com/puppetlabs/beaker'
|
9
9
|
s.license = 'Apache-2'
|
10
10
|
|
11
|
-
|
12
11
|
s.files = `git ls-files`.split("\n")
|
13
12
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
-
s.require_paths = [
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
|
+
s.require_paths = ['lib']
|
16
15
|
|
17
16
|
## Testing dependencies
|
18
17
|
s.add_development_dependency 'rspec'
|
@@ -10,7 +10,6 @@ module Beaker::CaCertHelper
|
|
10
10
|
install_ca_certs_on(hosts)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
13
|
##
|
15
14
|
# Install certs on Windows and OSX Hosts
|
16
15
|
#
|
@@ -23,7 +22,7 @@ module Beaker::CaCertHelper
|
|
23
22
|
if host['platform'] =~ /windows/i
|
24
23
|
create_cert_on_host(host, cert_name, ca)
|
25
24
|
add_windows_cert host, cert_name
|
26
|
-
elsif host['platform'] =~ /solaris/i
|
25
|
+
elsif host['platform'] =~ /solaris/i && host['pe_ver'] && version_is_less(host['pe_ver'], '4.0.0')
|
27
26
|
create_cert_on_host(host, cert_name, ca)
|
28
27
|
add_solaris_cert host, cert_name
|
29
28
|
end
|
@@ -136,8 +135,6 @@ A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
|
136
135
|
|
137
136
|
certs
|
138
137
|
end
|
139
|
-
|
140
|
-
|
141
138
|
end
|
142
139
|
|
143
140
|
include Beaker::CaCertHelper
|
@@ -2,22 +2,21 @@ require 'beaker'
|
|
2
2
|
require 'beaker/ca_cert_helper'
|
3
3
|
|
4
4
|
module Beaker::PuppetInstallHelper
|
5
|
-
def run_puppet_install_helper(type_arg=find_install_type,version=find_install_version)
|
6
|
-
run_puppet_install_helper_on(hosts,type_arg,version)
|
5
|
+
def run_puppet_install_helper(type_arg = find_install_type, version = find_install_version)
|
6
|
+
run_puppet_install_helper_on(hosts, type_arg, version)
|
7
7
|
end
|
8
8
|
|
9
9
|
# Takes a host(s) object, install type string, and install version string.
|
10
10
|
# - Type defaults to PE for PE nodes, and foss otherwise.
|
11
11
|
# - Version will default to the latest 3x foss/pe package, depending on type
|
12
|
-
def run_puppet_install_helper_on(hosts,type_arg=find_install_type,version=find_install_version)
|
13
|
-
|
12
|
+
def run_puppet_install_helper_on(hosts, type_arg = find_install_type, version = find_install_version)
|
14
13
|
type = type_arg || find_install_type
|
15
14
|
|
16
15
|
# Short circuit based on rspec-system and beaker variables
|
17
|
-
if ENV[
|
16
|
+
if (ENV['RS_PROVISION'] == 'no') || (ENV['BEAKER_provision'] == 'no')
|
18
17
|
Array(hosts).each do |host|
|
19
18
|
case type
|
20
|
-
when
|
19
|
+
when 'pe'
|
21
20
|
configure_pe_defaults_on(host)
|
22
21
|
when /foss|agent/
|
23
22
|
configure_foss_defaults_on(host)
|
@@ -35,48 +34,56 @@ module Beaker::PuppetInstallHelper
|
|
35
34
|
# PUPPET_INSTALL_TYPE=foss
|
36
35
|
# PUPPET_INSTALL_TYPE=agent
|
37
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
|
40
|
+
|
38
41
|
# Ensure windows 2003 is always set to 32 bit
|
39
42
|
Array(hosts).each do |host|
|
40
|
-
if host[
|
41
|
-
host["install_32"] = true
|
42
|
-
end
|
43
|
+
host['install_32'] = true if host['platform'] =~ /windows-2003/i
|
43
44
|
end
|
44
45
|
|
45
46
|
case type
|
46
|
-
when
|
47
|
+
when 'pe'
|
47
48
|
# These will skip hosts that are not supported
|
48
|
-
install_pe_on(Array(hosts),options.merge(
|
49
|
+
install_pe_on(Array(hosts), options.merge('pe_ver' => version))
|
49
50
|
install_ca_certs_on(Array(hosts))
|
50
|
-
when
|
51
|
-
opts = options.merge(
|
52
|
-
|
53
|
-
:default_action => "gem_install",
|
54
|
-
})
|
51
|
+
when 'foss'
|
52
|
+
opts = options.merge(version: version,
|
53
|
+
default_action: 'gem_install')
|
55
54
|
|
56
55
|
install_puppet_on(hosts, opts)
|
57
56
|
# XXX install_puppet_on() will only add_aio_defaults_on when the nodeset
|
58
57
|
# type == 'aio', but we don't want to depend on that.
|
59
|
-
if opts[:version]
|
58
|
+
if opts[:version] && !version_is_less(opts[:version], '4.0.0')
|
60
59
|
add_aio_defaults_on(hosts)
|
61
60
|
add_puppet_paths_on(hosts)
|
62
61
|
end
|
63
62
|
Array(hosts).each do |host|
|
64
|
-
if fact_on(host,
|
65
|
-
on host, "mkdir -p #{host[
|
63
|
+
if fact_on(host, 'osfamily') != 'windows'
|
64
|
+
on host, "mkdir -p #{host['distmoduledir']}"
|
66
65
|
# XXX Maybe this can just be removed? What PE/puppet version needs
|
67
66
|
# it?
|
68
|
-
on host, "touch #{host.puppet[
|
67
|
+
on host, "touch #{host.puppet['hiera_config']}"
|
69
68
|
end
|
70
|
-
if fact_on(host,
|
69
|
+
if fact_on(host, 'operatingsystem') == 'Debian'
|
71
70
|
on host, "echo 'export PATH=/var/lib/gems/1.8/bin/:${PATH}' >> ~/.bashrc"
|
72
71
|
end
|
73
|
-
if fact_on(host,
|
72
|
+
if fact_on(host, 'operatingsystem') == 'Solaris'
|
74
73
|
on host, "echo 'export PATH=/opt/puppet/bin:/var/ruby/1.8/gem_home/bin:${PATH}' >> ~/.bashrc"
|
75
74
|
end
|
76
75
|
end
|
77
|
-
when
|
78
|
-
|
79
|
-
|
76
|
+
when 'agent'
|
77
|
+
if ENV['PUPPET_AGENT_SHA'].nil?
|
78
|
+
# This will fail on hosts that are not supported; use foss and specify a 4.x version instead
|
79
|
+
install_puppet_agent_on(hosts, options.merge(version: version))
|
80
|
+
else
|
81
|
+
opts = options.merge(puppet_collection: 'PC1',
|
82
|
+
puppet_agent_sha: ENV['PUPPET_AGENT_SHA'],
|
83
|
+
puppet_agent_version: ENV['PUPPET_AGENT_SUITE_VERSION'] || ENV['PUPPET_AGENT_SHA'])
|
84
|
+
install_puppet_agent_dev_repo_on(hosts, opts)
|
85
|
+
end
|
86
|
+
|
80
87
|
# XXX install_puppet_agent_on() will only add_aio_defaults_on when the
|
81
88
|
# nodeset type == 'aio', but we don't want to depend on that.
|
82
89
|
add_aio_defaults_on(hosts)
|
@@ -87,23 +94,15 @@ module Beaker::PuppetInstallHelper
|
|
87
94
|
end
|
88
95
|
|
89
96
|
def find_install_type
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"foss"
|
96
|
-
end
|
97
|
+
ENV['PUPPET_INSTALL_TYPE'] || if default.is_pe?
|
98
|
+
'pe'
|
99
|
+
else
|
100
|
+
'agent'
|
101
|
+
end
|
97
102
|
end
|
98
103
|
|
99
104
|
def find_install_version
|
100
|
-
|
101
|
-
type
|
102
|
-
elsif type = ENV["PUPPET_VERSION"]
|
103
|
-
type
|
104
|
-
else
|
105
|
-
nil
|
106
|
-
end
|
105
|
+
ENV['PUPPET_INSTALL_VERSION'] || ENV['PUPPET_VERSION']
|
107
106
|
end
|
108
107
|
end
|
109
108
|
|
@@ -8,16 +8,16 @@ describe 'beaker::ca_cert_helper' do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
11
|
describe 'install_ca_certs_on' do
|
13
12
|
before :each do
|
14
13
|
allow(subject).to receive(:get_cert_hash).and_return(
|
15
|
-
|
16
|
-
|
14
|
+
'geotrustglobal.pem' => 'my cert string',
|
15
|
+
'usertrust-network.pem' => 'my user trust cert'
|
16
|
+
)
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
w2k3 = {
|
19
|
+
it 'windows 2003 node' do
|
20
|
+
w2k3 = { 'pe_ver' => '3.8.3', 'platform' => 'windows-2003r2-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
21
21
|
|
22
22
|
expect(subject).to receive(:add_windows_cert).with(w2k3, 'geotrustglobal.pem')
|
23
23
|
expect(subject).to receive(:create_cert_on_host).with(w2k3, 'geotrustglobal.pem', 'my cert string')
|
@@ -26,8 +26,8 @@ describe 'beaker::ca_cert_helper' do
|
|
26
26
|
subject.install_ca_certs_on w2k3
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
30
|
-
sol = {
|
29
|
+
it 'solaris 11 node' do
|
30
|
+
sol = { 'pe_ver' => '3.8.3', 'platform' => 'solaris-11-x86_64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
31
31
|
|
32
32
|
expect(subject).to receive(:add_solaris_cert).with(sol, 'geotrustglobal.pem')
|
33
33
|
expect(subject).to receive(:create_cert_on_host).with(sol, 'geotrustglobal.pem', 'my cert string')
|
@@ -38,24 +38,24 @@ describe 'beaker::ca_cert_helper' do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe 'add_windows_cert' do
|
41
|
-
it
|
42
|
-
host = {
|
41
|
+
it do
|
42
|
+
host = { 'platform' => 'windows-2003r2-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
43
43
|
expect(subject).to receive(:on).with(host, 'cmd /c certutil -v -addstore Root `cygpath -w geotrustglobal.pem`')
|
44
44
|
subject.add_windows_cert host, 'geotrustglobal.pem'
|
45
|
-
|
45
|
+
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe 'add_solaris_cert' do
|
49
|
-
it
|
50
|
-
host = {
|
49
|
+
it do
|
50
|
+
host = { 'platform' => 'solaris-11-x86_64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
51
51
|
expect(subject).to receive(:on).with(host, 'echo \'# geotrustglobal.pem\' >> /opt/puppet/ssl/cert.pem')
|
52
52
|
expect(subject).to receive(:on).with(host, 'cat geotrustglobal.pem >> /opt/puppet/ssl/cert.pem')
|
53
53
|
subject.add_solaris_cert host, 'geotrustglobal.pem'
|
54
|
-
|
54
|
+
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe 'get_cert_hash' do
|
58
|
-
it '
|
58
|
+
it 'contains 3 certs' do
|
59
59
|
cert_hash = subject.get_cert_hash
|
60
60
|
expect(cert_hash.length).to equal(3)
|
61
61
|
expect(cert_hash.class).to eq(Hash)
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe '
|
3
|
+
describe 'Beaker::PuppetInstallHelper' do
|
4
4
|
let :subject do
|
5
5
|
Class.new { include Beaker::PuppetInstallHelper }
|
6
6
|
end
|
7
7
|
let :hosts do
|
8
|
-
foss_host = double(
|
9
|
-
pe_host = double(
|
10
|
-
allow(foss_host).to receive(:[]).with(
|
11
|
-
allow(foss_host).to receive(:[]).with(
|
12
|
-
allow(foss_host).to receive(:[]).with(
|
13
|
-
allow(foss_host).to receive(:puppet).and_return(
|
14
|
-
allow(pe_host).to receive(:[]).with(
|
15
|
-
allow(pe_host).to receive(:[]).with(
|
16
|
-
allow(pe_host).to receive(:[]).with(
|
17
|
-
allow(pe_host).to receive(:puppet).and_return(
|
8
|
+
foss_host = double(is_pe?: false)
|
9
|
+
pe_host = double(is_pe?: true)
|
10
|
+
allow(foss_host).to receive(:[]).with('distmoduledir').and_return('/dne')
|
11
|
+
allow(foss_host).to receive(:[]).with('platform').and_return('Debian')
|
12
|
+
allow(foss_host).to receive(:[]).with('pe_ver').and_return(nil)
|
13
|
+
allow(foss_host).to receive(:puppet).and_return('hiera_config' => '/dne')
|
14
|
+
allow(pe_host).to receive(:[]).with('pe_ver').and_return('3.8.3')
|
15
|
+
allow(pe_host).to receive(:[]).with('distmoduledir').and_return('/dne')
|
16
|
+
allow(pe_host).to receive(:[]).with('platform').and_return('Debian')
|
17
|
+
allow(pe_host).to receive(:puppet).and_return('hiera_config' => '/dne')
|
18
18
|
[foss_host, pe_host]
|
19
19
|
end
|
20
20
|
before :each do
|
@@ -23,9 +23,11 @@ describe 'beaker::puppet_install_helper' do
|
|
23
23
|
allow(subject).to receive(:fact_on)
|
24
24
|
end
|
25
25
|
after :each do
|
26
|
-
ENV.delete(
|
27
|
-
ENV.delete(
|
28
|
-
ENV.delete(
|
26
|
+
ENV.delete('PUPPET_VERSION')
|
27
|
+
ENV.delete('PUPPET_INSTALL_VERSION')
|
28
|
+
ENV.delete('PUPPET_INSTALL_TYPE')
|
29
|
+
ENV.delete('PUPPET_AGENT_SHA')
|
30
|
+
ENV.delete('PUPPET_AGENT_SUITE_VERSION')
|
29
31
|
end
|
30
32
|
describe '#run_puppet_install_helper' do
|
31
33
|
before :each do
|
@@ -33,97 +35,118 @@ describe 'beaker::puppet_install_helper' do
|
|
33
35
|
allow(subject).to receive(:default).and_return(hosts[0])
|
34
36
|
end
|
35
37
|
it 'calls run_puppet_install_helper_on on each host' do
|
36
|
-
expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,
|
38
|
+
expect(subject).to receive(:run_puppet_install_helper_on).with(hosts, 'agent', nil)
|
37
39
|
subject.run_puppet_install_helper
|
38
40
|
end
|
39
|
-
|
41
|
+
%w(PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
|
40
42
|
it 'calls run_puppet_install_helper_on on each host with a version ' do
|
41
|
-
ENV[version_var] =
|
42
|
-
expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,
|
43
|
+
ENV[version_var] = '4.1.0'
|
44
|
+
expect(subject).to receive(:run_puppet_install_helper_on).with(hosts, 'agent', '4.1.0')
|
43
45
|
subject.run_puppet_install_helper
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
describe '#run_puppet_install_helper_on' do
|
48
|
-
context
|
49
|
-
it
|
50
|
+
context 'for default' do
|
51
|
+
it 'uses agent by default for non-pe nodes' do
|
50
52
|
expect(subject).to receive(:default).and_return(hosts[0])
|
51
|
-
expect(subject).to receive(:
|
53
|
+
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
54
|
+
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
55
|
+
expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
|
52
56
|
subject.run_puppet_install_helper_on(hosts)
|
53
57
|
end
|
54
|
-
it
|
55
|
-
w2k3 = {
|
56
|
-
win_hosts = [
|
57
|
-
expect(subject).to receive(:default).and_return(double(
|
58
|
-
expect(subject).to receive(:install_pe_on).with([w2k3.merge(
|
58
|
+
it 'windows 2003 node' do
|
59
|
+
w2k3 = { 'platform' => 'windows-2003r2-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
60
|
+
win_hosts = [w2k3]
|
61
|
+
expect(subject).to receive(:default).and_return(double(is_pe?: true))
|
62
|
+
expect(subject).to receive(:install_pe_on).with([w2k3.merge('install_32' => true)], 'pe_ver' => nil)
|
59
63
|
expect(subject).to receive(:create_cert_on_host).exactly(3).times
|
60
64
|
expect(subject).to receive(:add_windows_cert).exactly(3).times
|
61
65
|
subject.run_puppet_install_helper_on(win_hosts)
|
62
66
|
end
|
63
|
-
it
|
67
|
+
it 'uses PE by default for PE nodes' do
|
64
68
|
expect(subject).to receive(:default).and_return(hosts[1])
|
65
|
-
expect(subject).to receive(:install_pe_on).with(hosts,
|
69
|
+
expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => nil)
|
66
70
|
subject.run_puppet_install_helper_on(hosts)
|
67
71
|
end
|
68
72
|
end
|
69
|
-
context
|
70
|
-
it
|
71
|
-
ENV[
|
72
|
-
expect(subject).to receive(:install_puppet_on).with(hosts,
|
73
|
+
context 'for foss' do
|
74
|
+
it 'uses foss explicitly' do
|
75
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
76
|
+
expect(subject).to receive(:install_puppet_on).with(hosts, version: nil, default_action: 'gem_install')
|
73
77
|
subject.run_puppet_install_helper_on(hosts)
|
74
78
|
end
|
75
|
-
|
76
|
-
it
|
77
|
-
ENV[
|
78
|
-
ENV[version_var] =
|
79
|
-
expect(subject).to receive(:install_puppet_on).with(hosts,
|
79
|
+
%w(PUPPET_VERSION PUPPET_INSTALL_VERSION).each do |version_var|
|
80
|
+
it 'uses foss with a version' do
|
81
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
82
|
+
ENV[version_var] = '3.8.1'
|
83
|
+
expect(subject).to receive(:install_puppet_on).with(hosts, version: '3.8.1', default_action: 'gem_install')
|
80
84
|
subject.run_puppet_install_helper_on(hosts)
|
81
85
|
end
|
82
|
-
it
|
83
|
-
ENV[
|
84
|
-
ENV[version_var] =
|
85
|
-
expect(subject).to receive(:install_puppet_on).with(hosts,
|
86
|
+
it 'uses foss with a >4 version detects AIO' do
|
87
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'foss'
|
88
|
+
ENV[version_var] = '4.1.0'
|
89
|
+
expect(subject).to receive(:install_puppet_on).with(hosts, version: '4.1.0', default_action: 'gem_install')
|
86
90
|
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
87
91
|
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
88
92
|
subject.run_puppet_install_helper_on(hosts)
|
89
93
|
end
|
90
94
|
end
|
91
95
|
end
|
92
|
-
context
|
93
|
-
it
|
94
|
-
ENV[
|
95
|
-
expect(subject).to receive(:install_pe_on).with(hosts,
|
96
|
+
context 'for PE' do
|
97
|
+
it 'uses PE explicitly' do
|
98
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'pe'
|
99
|
+
expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => nil)
|
96
100
|
subject.run_puppet_install_helper_on(hosts)
|
97
101
|
end
|
98
|
-
it
|
99
|
-
ENV[
|
100
|
-
ENV[
|
101
|
-
expect(subject).to receive(:install_pe_on).with(hosts,
|
102
|
+
it 'uses PE with a version' do
|
103
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'pe'
|
104
|
+
ENV['PUPPET_INSTALL_VERSION'] = '3.8.1'
|
105
|
+
expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => '3.8.1')
|
102
106
|
subject.run_puppet_install_helper_on(hosts)
|
103
107
|
end
|
104
|
-
it
|
105
|
-
sol = {
|
106
|
-
hosts = [
|
107
|
-
ENV[
|
108
|
-
ENV[
|
109
|
-
expect(subject).to receive(:install_pe_on).with(hosts,
|
108
|
+
it 'installs certs on PE 3 solaris' do
|
109
|
+
sol = { 'pe_ver' => '3.8.3', 'platform' => 'solaris-11-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne' }
|
110
|
+
hosts = [sol]
|
111
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'pe'
|
112
|
+
ENV['PUPPET_INSTALL_VERSION'] = '3.8.1'
|
113
|
+
expect(subject).to receive(:install_pe_on).with(hosts, 'pe_ver' => '3.8.1')
|
110
114
|
expect(subject).to receive(:create_cert_on_host).exactly(3).times
|
111
115
|
expect(subject).to receive(:add_solaris_cert).exactly(3).times
|
112
116
|
subject.run_puppet_install_helper_on(hosts)
|
113
117
|
end
|
114
118
|
end
|
115
|
-
context
|
116
|
-
it
|
117
|
-
ENV[
|
118
|
-
expect(subject).to receive(:install_puppet_agent_on).with(hosts,
|
119
|
+
context 'for puppet-agent' do
|
120
|
+
it 'uses agent explicitly' do
|
121
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'agent'
|
122
|
+
expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: nil)
|
123
|
+
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
124
|
+
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
125
|
+
subject.run_puppet_install_helper_on(hosts)
|
126
|
+
end
|
127
|
+
it 'uses foss with a version' do
|
128
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'agent'
|
129
|
+
ENV['PUPPET_INSTALL_VERSION'] = '1.1.0'
|
130
|
+
expect(subject).to receive(:install_puppet_agent_on).with(hosts, version: '1.1.0')
|
131
|
+
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
132
|
+
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
133
|
+
subject.run_puppet_install_helper_on(hosts)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
context 'for puppet-agent development repo' do
|
137
|
+
before :each do
|
138
|
+
ENV['PUPPET_INSTALL_TYPE'] = 'agent'
|
139
|
+
ENV['PUPPET_AGENT_SHA'] = 'abc123'
|
140
|
+
end
|
141
|
+
it 'uses a development repo' do
|
142
|
+
expect(subject).to receive(:install_puppet_agent_dev_repo_on).with(hosts, puppet_collection: 'PC1', puppet_agent_sha: 'abc123', puppet_agent_version: 'abc123')
|
119
143
|
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
120
144
|
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
121
145
|
subject.run_puppet_install_helper_on(hosts)
|
122
146
|
end
|
123
|
-
it
|
124
|
-
ENV[
|
125
|
-
|
126
|
-
expect(subject).to receive(:install_puppet_agent_on).with(hosts,{:version => "1.1.0"})
|
147
|
+
it 'uses a development repo with suite version' do
|
148
|
+
ENV['PUPPET_AGENT_SUITE_VERSION'] = '1.0.0.0.gabc123'
|
149
|
+
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')
|
127
150
|
expect(subject).to receive(:add_aio_defaults_on).with(hosts)
|
128
151
|
expect(subject).to receive(:add_puppet_paths_on).with(hosts)
|
129
152
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,19 +38,23 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
|
-
description:
|
41
|
+
description: Provides a unified external interface to choosing which version of puppet
|
42
|
+
to install on the systems under test. For details on Beaker, see https://github.com/puppetlabs/beaker
|
42
43
|
email:
|
43
|
-
- hunter@
|
44
|
+
- hunter@puppet.com
|
44
45
|
executables: []
|
45
46
|
extensions: []
|
46
47
|
extra_rdoc_files: []
|
47
48
|
files:
|
48
49
|
- ".gitignore"
|
49
50
|
- ".travis.yml"
|
51
|
+
- CHANGELOG.md
|
50
52
|
- CONTRIBUTING.md
|
51
53
|
- Gemfile
|
52
54
|
- LICENSE
|
55
|
+
- MAINTAINERS
|
53
56
|
- README.md
|
57
|
+
- Rakefile
|
54
58
|
- beaker-puppet_install_helper.gemspec
|
55
59
|
- lib/beaker/ca_cert_helper.rb
|
56
60
|
- lib/beaker/puppet_install_helper.rb
|