beaker-puppet_install_helper 0.3.0 → 0.3.1

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: 17e6a51cd929ad47b6650028e546f4e0e5708111
4
- data.tar.gz: b782f88f97d51b289c7198683e0ed3c7829e96a2
3
+ metadata.gz: bfd5c439c7716c6e608e803b8b233c871a6added
4
+ data.tar.gz: 51ad611cb0b5d67beb392d51914e221ab6c4ca1f
5
5
  SHA512:
6
- metadata.gz: 8d1fccdeb2a26047783bb3d6be89788195aefe060520edaeca7bddfd8b32e19e1bfed1f5664a676267a1d8e5d504aa30661f370a50fc4a8b2498aa8efcb25210
7
- data.tar.gz: e357f54eca20d2e932d7c8664db898b0a0897eeecfbde0eab44fbb9897c4d7b556de8194a02915d0eef54b7dedbffc276028f3bbe517427ef778b83420fb4cea
6
+ metadata.gz: 57d559f50199430bffa0fa7565a161cfd62395e24f335935d8c192b46c3a08cab4abd4c8b20cbd6d80c4e936ad99d17dee193a27cb6c1f1d9b86acff5153fcc5
7
+ data.tar.gz: 981118b529218403ab27707c1e0fc2e6d1c5a176a9face7c9f0e15ad440f77b435a125b17231ee394e90d2c7f173d6d9e8d42d403199346667707e2a6503db79
data/README.md CHANGED
@@ -4,16 +4,16 @@ 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_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 `PUPPET_INSTALL_VERSION` and/or `PUPPET_INSTALL_TYPE` in the following combinations to have puppet installed on the desired hosts:
8
8
 
9
9
  - `PUPPET_INSTALL_TYPE` is unset: it will look at the default node's type (ie, `default.is_pe?` and choose either foss or pe methods below.
10
- - `PUPPET_INSTALL_TYPE=pe` will read `PUPPET_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=foss` will read `PUPPET_VERSION` and:
12
- - if `PUPPET_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
- - if `PUPPET_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_VERSION` and install that version of puppet-agent (eg, `PUPPET_INSTALL_TYPE=agent PUPPET_VERSION=1.0.0`)
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=foss` will read `PUPPET_INSTALL_VERSION` and:
12
+ - 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
+ - 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
- The best way is explicitly set `PUPPET_INSTALL_TYPE` and `PUPPET_VERSION` to what you want. It'll probably do what you expect.
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
18
  ### `install_ca_certs`
19
19
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "beaker-puppet_install_helper"
3
- s.version = '0.3.0'
3
+ s.version = '0.3.1'
4
4
  s.authors = ["Puppetlabs"]
5
5
  s.email = ["hunter@puppetlabs.com"]
6
6
  s.homepage = "https://github.com/puppetlabs/beaker-puppet_install_helper"
@@ -2,14 +2,14 @@ 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=ENV["PUPPET_VERSION"])
5
+ def run_puppet_install_helper(type_arg=find_install_type,version=find_install_version)
6
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=ENV["PUPPET_VERSION"])
12
+ def run_puppet_install_helper_on(hosts,type_arg=find_install_type,version=find_install_version)
13
13
 
14
14
  type = type_arg || find_install_type
15
15
 
@@ -27,9 +27,9 @@ module Beaker::PuppetInstallHelper
27
27
  end
28
28
 
29
29
  # Example environment variables to be read:
30
- # PUPPET_VERSION=3.8.1 <-- for foss/pe/gem
31
- # PUPPET_VERSION=4.1.0 <-- for agent/gem
32
- # PUPPET_VERSION=1.0.1 <-- for agent
30
+ # PUPPET_INSTALL_VERSION=3.8.1 <-- for foss/pe/gem
31
+ # PUPPET_INSTALL_VERSION=4.1.0 <-- for agent/gem
32
+ # PUPPET_INSTALL_VERSION=1.0.1 <-- for agent
33
33
  #
34
34
  # PUPPET_INSTALL_TYPE=pe
35
35
  # PUPPET_INSTALL_TYPE=foss
@@ -94,6 +94,16 @@ module Beaker::PuppetInstallHelper
94
94
  "foss"
95
95
  end
96
96
  end
97
+
98
+ def find_install_version
99
+ if type = ENV["PUPPET_INSTALL_VERSION"]
100
+ type
101
+ elsif type = ENV["PUPPET_VERSION"]
102
+ type
103
+ else
104
+ nil
105
+ end
106
+ end
97
107
  end
98
108
 
99
109
  include Beaker::PuppetInstallHelper
@@ -22,6 +22,7 @@ describe 'beaker::puppet_install_helper' do
22
22
  end
23
23
  after :each do
24
24
  ENV.delete("PUPPET_VERSION")
25
+ ENV.delete("PUPPET_INSTALL_VERSION")
25
26
  ENV.delete("PUPPET_INSTALL_TYPE")
26
27
  end
27
28
  describe '#run_puppet_install_helper' do
@@ -33,10 +34,12 @@ describe 'beaker::puppet_install_helper' do
33
34
  expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,"foss",nil)
34
35
  subject.run_puppet_install_helper
35
36
  end
36
- it 'calls run_puppet_install_helper_on on each host with a version ' do
37
- ENV["PUPPET_VERSION"] = "4.1.0"
38
- expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,"foss","4.1.0")
39
- subject.run_puppet_install_helper
37
+ ["PUPPET_VERSION","PUPPET_INSTALL_VERSION"].each do |version_var|
38
+ it 'calls run_puppet_install_helper_on on each host with a version ' do
39
+ ENV[version_var] = "4.1.0"
40
+ expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,"foss","4.1.0")
41
+ subject.run_puppet_install_helper
42
+ end
40
43
  end
41
44
  end
42
45
  describe '#run_puppet_install_helper_on' do
@@ -65,19 +68,21 @@ describe 'beaker::puppet_install_helper' do
65
68
  expect(subject).to receive(:install_puppet_on).with(hosts,{:version => nil,:default_action => "gem_install"})
66
69
  subject.run_puppet_install_helper_on(hosts)
67
70
  end
68
- it "uses foss with a version" do
69
- ENV["PUPPET_INSTALL_TYPE"] = "foss"
70
- ENV["PUPPET_VERSION"] = "3.8.1"
71
- expect(subject).to receive(:install_puppet_on).with(hosts,{:version => "3.8.1",:default_action => "gem_install"})
72
- subject.run_puppet_install_helper_on(hosts)
73
- end
74
- it "uses foss with a >4 version detects AIO" do
75
- ENV["PUPPET_INSTALL_TYPE"] = "foss"
76
- ENV["PUPPET_VERSION"] = "4.1.0"
77
- expect(subject).to receive(:install_puppet_on).with(hosts,{:version => "4.1.0",:default_action => "gem_install"})
78
- expect(subject).to receive(:add_aio_defaults_on).with(hosts)
79
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
80
- subject.run_puppet_install_helper_on(hosts)
71
+ ["PUPPET_VERSION","PUPPET_INSTALL_VERSION"].each do |version_var|
72
+ it "uses foss with a version" do
73
+ ENV["PUPPET_INSTALL_TYPE"] = "foss"
74
+ ENV[version_var] = "3.8.1"
75
+ expect(subject).to receive(:install_puppet_on).with(hosts,{:version => "3.8.1",:default_action => "gem_install"})
76
+ subject.run_puppet_install_helper_on(hosts)
77
+ end
78
+ it "uses foss with a >4 version detects AIO" do
79
+ ENV["PUPPET_INSTALL_TYPE"] = "foss"
80
+ ENV[version_var] = "4.1.0"
81
+ expect(subject).to receive(:install_puppet_on).with(hosts,{:version => "4.1.0",:default_action => "gem_install"})
82
+ expect(subject).to receive(:add_aio_defaults_on).with(hosts)
83
+ expect(subject).to receive(:add_puppet_paths_on).with(hosts)
84
+ subject.run_puppet_install_helper_on(hosts)
85
+ end
81
86
  end
82
87
  end
83
88
  context "for PE" do
@@ -88,7 +93,7 @@ describe 'beaker::puppet_install_helper' do
88
93
  end
89
94
  it "uses PE with a version" do
90
95
  ENV["PUPPET_INSTALL_TYPE"] = "pe"
91
- ENV["PUPPET_VERSION"] = "3.8.1"
96
+ ENV["PUPPET_INSTALL_VERSION"] = "3.8.1"
92
97
  expect(subject).to receive(:install_pe_on).with(hosts,{"pe_ver" => "3.8.1"})
93
98
  subject.run_puppet_install_helper_on(hosts)
94
99
  end
@@ -103,7 +108,7 @@ describe 'beaker::puppet_install_helper' do
103
108
  end
104
109
  it "uses foss with a version" do
105
110
  ENV["PUPPET_INSTALL_TYPE"] = "agent"
106
- ENV["PUPPET_VERSION"] = "1.1.0"
111
+ ENV["PUPPET_INSTALL_VERSION"] = "1.1.0"
107
112
  expect(subject).to receive(:install_puppet_agent_on).with(hosts,{:version => "1.1.0"})
108
113
  expect(subject).to receive(:add_aio_defaults_on).with(hosts)
109
114
  expect(subject).to receive(:add_puppet_paths_on).with(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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec