beaker-puppet_install_helper 0.1.1 → 0.1.2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGMwYzBjYWE3ZWY0Zjk4MDBmODMzMzNjZDJlZmVhZmZiOTEwNTJkNQ==
4
+ NjA3MTZjYjdiZThlMTFjNjJiMzBhOTlmY2ViZTM5MzAxOTg2NzAzMA==
5
5
  data.tar.gz: !binary |-
6
- OGVmMzlkMWRjNzdhOTUxMDlhMmYxY2ExZTM1NDhjNzlhY2QyYmI0MA==
6
+ MDU4MWNjYjMwNTM1MTliYjMwNjA4NGE4OGMzZjFkNDkxYTM2MDJmMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2U4N2IzMDk4NDU2NTAxMmE5NDY0YTZhYjJhZDhhMTcyNTUzYjg5M2E4NTVk
10
- YTRjNjM5MDY0NDEwZTI4ODNhYmU4ZTA1ZGI4ZjNlY2NhY2Q0MGM5ZjA0NDM0
11
- ZjE2MjA0NTNkZjYwNTFiYzMyMWE3MmExNzAxOTM3ZGQ4ZGVmY2Y=
9
+ MDhiYzZlYTlmYjBhZTgyNTk0ZmQyNTkwNDM2YzczMmIxZmRhODk5NGJmYzA3
10
+ MzNmZDAyNzJiNmQ0MGFlOGVkZDcxODJlMjYzMWM1ZGEwMjk3YmE3Mzc5YmRk
11
+ ODZhNzVlNGUzODlkY2E4ZTA2NjE0MDIxNTFiZDVkZTY5ZGQ5NTE=
12
12
  data.tar.gz: !binary |-
13
- MWEyYjYwNWE4M2VmYzgwY2JjOTI2ZDEzNTg2NmI5NTNmYTRmZmYwYjMyZDkz
14
- NDZiYmYxOTUxMDJjNjcyOTM0MzMwNjFiNGU0YjBiODc2NGI1OTU4Nzg3NDUx
15
- ZDNhNTZjN2MwMDNhNWFlZGY0N2RiMGJjODk0ZWRmZDk1NzljZGY=
13
+ Mzc5YWY3ZjdhNmJkZTY1MTIyMjE2ZWY2YjQ2MGQzNTI1MmQ2OTY0ZTdhNzhm
14
+ MmNlNTVhYWI2NmY5ZDhhZWU3N2FkMjEzMDAwODE5OTQ3NjFjYTU5NDVjNzZi
15
+ OTUzMGNiMjE1MzlkNDI1YWUyNTljY2FkNzZmZWJjMTQ3NjBiNjE=
data/Gemfile CHANGED
@@ -1,48 +1,3 @@
1
1
  source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
2
 
3
3
  gemspec
4
- #def location_for(place, fake_version = nil)
5
- # if place =~ /^(git:[^#]*)#(.*)/
6
- # [fake_version, { :git => $1, :branch => $2, :require => false }].compact
7
- # elsif place =~ /^file:\/\/(.*)/
8
- # ['>= 0', { :path => File.expand_path($1), :require => false }]
9
- # else
10
- # [place, { :require => false }]
11
- # end
12
- #end
13
- #
14
- #group :development, :unit_tests do
15
- # gem 'rspec-core', '3.1.7', :require => false
16
- # gem 'puppetlabs_spec_helper', :require => false
17
- # gem 'simplecov', :require => false
18
- # gem 'puppet_facts', :require => false
19
- # gem 'json', :require => false
20
- #end
21
- #
22
- #group :system_tests do
23
- # if beaker_version = ENV['BEAKER_VERSION']
24
- # gem 'beaker', *location_for(beaker_version)
25
- # end
26
- # if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
27
- # gem 'beaker-rspec', *location_for(beaker_rspec_version)
28
- # else
29
- # gem 'beaker-rspec', :require => false
30
- # end
31
- # gem 'serverspec', :require => false
32
- #end
33
- #
34
- #
35
- #
36
- #if facterversion = ENV['FACTER_GEM_VERSION']
37
- # gem 'facter', facterversion, :require => false
38
- #else
39
- # gem 'facter', :require => false
40
- #end
41
- #
42
- #if puppetversion = ENV['PUPPET_GEM_VERSION']
43
- # gem 'puppet', puppetversion, :require => false
44
- #else
45
- # gem 'puppet', :require => false
46
- #end
47
- #
48
- ## vim:ft=ruby
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "beaker-puppet_install_helper"
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
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,7 +2,7 @@ require 'beaker'
2
2
 
3
3
  module Beaker::PuppetInstallHelper
4
4
  def run_puppet_install_helper(type_arg=find_install_type,version=ENV["PUPPET_VERSION"])
5
- run_puppet_install_helper_on(hosts,type_arg,version)
5
+ run_puppet_install_helper_on(default,type_arg,version)
6
6
  end
7
7
 
8
8
  # Takes a host(s) object, install type string, and install version string.
@@ -26,9 +26,7 @@ module Beaker::PuppetInstallHelper
26
26
  case type
27
27
  when "pe"
28
28
  # This will skip hosts that are not supported
29
- install_pe_on(hosts,{"pe_ver" => version})
30
- add_pe_defaults_on(hosts)
31
- add_puppet_paths_on(hosts)
29
+ install_pe_on(Array(hosts),{"pe_ver" => version})
32
30
  when "foss"
33
31
  opts = {
34
32
  :version => version,
@@ -36,16 +34,18 @@ module Beaker::PuppetInstallHelper
36
34
  }
37
35
 
38
36
  install_puppet_on(hosts, opts)
37
+ # XXX install_puppet_on() will only add_aio_defaults_on when the nodeset
38
+ # type == 'aio', but we don't want to depend on that.
39
39
  if opts[:version] and not version_is_less(opts[:version], '4.0.0')
40
40
  add_aio_defaults_on(hosts)
41
- else
42
- add_foss_defaults_on(hosts)
41
+ add_puppet_paths_on(hosts)
43
42
  end
44
- add_puppet_paths_on(hosts)
45
43
  Array(hosts).each do |host|
46
44
  if fact_on(host,"osfamily") != "windows"
47
45
  on host, "mkdir -p #{host["distmoduledir"]}"
48
- on host, "touch #{host["hieraconf"]}"
46
+ # XXX Maybe this can just be removed? What PE/puppet version needs
47
+ # it?
48
+ on host, "touch #{host.puppet["hiera_config"]}"
49
49
  end
50
50
  if fact_on(host, "operatingsystem") == "Debian"
51
51
  on host, "echo 'export PATH=/var/lib/gems/1.8/bin/:${PATH}' >> ~/.bashrc"
@@ -57,6 +57,8 @@ module Beaker::PuppetInstallHelper
57
57
  when "agent"
58
58
  # This will fail on hosts that are not supported; use foss and specify a 4.x version instead
59
59
  install_puppet_agent_on(hosts, {:version => version})
60
+ # XXX install_puppet_agent_on() will only add_aio_defaults_on when the
61
+ # nodeset type == 'aio', but we don't want to depend on that.
60
62
  add_aio_defaults_on(hosts)
61
63
  add_puppet_paths_on(hosts)
62
64
  else
@@ -5,8 +5,13 @@ describe 'beaker::puppet_install_helper' do
5
5
  Class.new { include Beaker::PuppetInstallHelper }
6
6
  end
7
7
  let :hosts do
8
- host = { "distmoduledir" => "/dne", "hieraconf" => "/dne" }
9
- [ host, host, host, ]
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(:puppet).and_return({"hiera_config" => "/dne"})
12
+ allow(pe_host).to receive(:[]).with("distmoduledir").and_return("/dne")
13
+ allow(pe_host).to receive(:puppet).and_return({"hiera_config" => "/dne"})
14
+ [foss_host, pe_host]
10
15
  end
11
16
  before :each do
12
17
  allow(subject).to receive(:on)
@@ -18,33 +23,29 @@ describe 'beaker::puppet_install_helper' do
18
23
  end
19
24
  describe '#run_puppet_install_helper' do
20
25
  before :each do
21
- allow(subject).to receive(:default).and_return(double(:is_pe? => false))
22
26
  allow(subject).to receive(:hosts).and_return(hosts)
27
+ allow(subject).to receive(:default).and_return(hosts[0])
23
28
  end
24
29
  it 'calls run_puppet_install_helper_on on each host' do
25
- expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,"foss",nil)
30
+ expect(subject).to receive(:run_puppet_install_helper_on).with(hosts[0],"foss",nil)
26
31
  subject.run_puppet_install_helper
27
32
  end
28
33
  it 'calls run_puppet_install_helper_on on each host with a version ' do
29
34
  ENV["PUPPET_VERSION"] = "4.1.0"
30
- expect(subject).to receive(:run_puppet_install_helper_on).with(hosts,"foss","4.1.0")
35
+ expect(subject).to receive(:run_puppet_install_helper_on).with(hosts[0],"foss","4.1.0")
31
36
  subject.run_puppet_install_helper
32
37
  end
33
38
  end
34
39
  describe '#run_puppet_install_helper_on' do
35
40
  context "for default" do
36
41
  it "uses foss by default for non-pe nodes" do
37
- expect(subject).to receive(:default).and_return(double(:is_pe? => false))
42
+ expect(subject).to receive(:default).and_return(hosts[0])
38
43
  expect(subject).to receive(:install_puppet_on).with(hosts,{:version => nil,:default_action => "gem_install"})
39
- expect(subject).to receive(:add_foss_defaults_on).with(hosts)
40
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
41
44
  subject.run_puppet_install_helper_on(hosts)
42
45
  end
43
46
  it "uses PE by default for PE nodes" do
44
- expect(subject).to receive(:default).and_return(double(:is_pe? => true))
47
+ expect(subject).to receive(:default).and_return(hosts[1])
45
48
  expect(subject).to receive(:install_pe_on).with(hosts,{"pe_ver" => nil})
46
- expect(subject).to receive(:add_pe_defaults_on).with(hosts)
47
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
48
49
  subject.run_puppet_install_helper_on(hosts)
49
50
  end
50
51
  end
@@ -52,16 +53,12 @@ describe 'beaker::puppet_install_helper' do
52
53
  it "uses foss explicitly" do
53
54
  ENV["PUPPET_INSTALL_TYPE"] = "foss"
54
55
  expect(subject).to receive(:install_puppet_on).with(hosts,{:version => nil,:default_action => "gem_install"})
55
- expect(subject).to receive(:add_foss_defaults_on).with(hosts)
56
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
57
56
  subject.run_puppet_install_helper_on(hosts)
58
57
  end
59
58
  it "uses foss with a version" do
60
59
  ENV["PUPPET_INSTALL_TYPE"] = "foss"
61
60
  ENV["PUPPET_VERSION"] = "3.8.1"
62
61
  expect(subject).to receive(:install_puppet_on).with(hosts,{:version => "3.8.1",:default_action => "gem_install"})
63
- expect(subject).to receive(:add_foss_defaults_on).with(hosts)
64
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
65
62
  subject.run_puppet_install_helper_on(hosts)
66
63
  end
67
64
  it "uses foss with a >4 version detects AIO" do
@@ -77,16 +74,12 @@ describe 'beaker::puppet_install_helper' do
77
74
  it "uses PE explicitly" do
78
75
  ENV["PUPPET_INSTALL_TYPE"] = "pe"
79
76
  expect(subject).to receive(:install_pe_on).with(hosts,{"pe_ver" => nil})
80
- expect(subject).to receive(:add_pe_defaults_on).with(hosts)
81
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
82
77
  subject.run_puppet_install_helper_on(hosts)
83
78
  end
84
79
  it "uses PE with a version" do
85
80
  ENV["PUPPET_INSTALL_TYPE"] = "pe"
86
81
  ENV["PUPPET_VERSION"] = "3.8.1"
87
82
  expect(subject).to receive(:install_pe_on).with(hosts,{"pe_ver" => "3.8.1"})
88
- expect(subject).to receive(:add_pe_defaults_on).with(hosts)
89
- expect(subject).to receive(:add_puppet_paths_on).with(hosts)
90
83
  subject.run_puppet_install_helper_on(hosts)
91
84
  end
92
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet_install_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs