beaker-puppet 0.15.2 → 0.16.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: 025f9370e1244e63e10ab6629c1069289a801c11
4
- data.tar.gz: 71d17c2a14d18f791ec4d1744e7973f7c0487016
3
+ metadata.gz: f99b5ea3158b18360735f58958b7994df0bc002e
4
+ data.tar.gz: 74049c9e805053122780a57be393f51bf53e2fe5
5
5
  SHA512:
6
- metadata.gz: 8f3acb63dacd5f6d3944c00d79ce8919c7cb74d9777421d657e72edf02496682cea0b635740a5597a11af62ee193bbd7231b4c865163e51b737bda7c97eb6146
7
- data.tar.gz: 9c8f52ec56ef1498dc66cdc514c6733d046c268ca77525a326416a08f5246c51c2370ab75c0b15b9380ad13a96e91ac2ab5126765d934e4aefbf562a0ca019de
6
+ metadata.gz: c065c58d81584d892e58fab12abc9fabd69d7487351417575d76e5e54230b1c4b4dd26ab01faa41c36ca4b99f41819b85dd27696d055de56db60ef5377817f1d
7
+ data.tar.gz: 83c38cb1256117144fa55f972c35d4a757f06864bf408e7593bfa5ec0e87ba2e7e18bdae614a6aaa0f91d72aebdb30cb45ce9b9ca7197797b2af21d05cd6ad7c
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  # Testing dependencies
21
21
  s.add_development_dependency 'rspec', '~> 3.0'
22
22
  s.add_development_dependency 'rspec-its'
23
- s.add_development_dependency 'fakefs', '~> 0.6'
23
+ s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14.0'
24
24
  s.add_development_dependency 'rake', '~> 10.1'
25
25
  s.add_development_dependency 'simplecov'
26
26
  s.add_development_dependency 'pry', '~> 0.10'
@@ -27,7 +27,29 @@ module BeakerPuppet
27
27
  return sha_yaml_folder_url, file_hash[:platform_data]
28
28
  end
29
29
 
30
- # gets the artifact & repo_config URLs for this host in the build
30
+ # Get the host's packaging platform, based on beaker-hostgenerator's
31
+ # osinfo hash and the environment. Set ENV['BEAKER_PACKAGING_PLATFORMS']
32
+ # to override the default packaging platform specified by
33
+ # beaker-hostgenerator. This should be a comma-separated string with
34
+ # entries of the format `<host-platform>=<override-platform>`
35
+ #
36
+ # @param [Host] host Host whose packaging platform to determine
37
+ # @return [String] The packaging platform
38
+ def host_packaging_platform(host)
39
+ packaging_platform = host[:packaging_platform]
40
+ if ENV['BEAKER_PACKAGING_PLATFORMS']
41
+ overrides = Hash[ENV['BEAKER_PACKAGING_PLATFORMS'].split(',').map { |e| e.split('=') }]
42
+ logger.debug("Found packaging platform overrides: #{overrides}")
43
+ if overrides[host[:platform]]
44
+ platform = overrides[host[:platform]]
45
+ logger.debug("Default beaker packaging platform '#{host[:packaging_platform]}' for '#{host[:platform]}' overridden as '#{platform}'")
46
+ packaging_platform = platform
47
+ end
48
+ end
49
+ packaging_platform
50
+ end
51
+
52
+ # Gets the artifact & repo_config URLs for this host in the build.
31
53
  #
32
54
  # @param [Host] host Host to get artifact URL for
33
55
  # @param [Hash] build_details Details of the build in a hash
@@ -36,7 +58,7 @@ module BeakerPuppet
36
58
  # @return [String, String] URL to the build artifact, URL to the repo_config
37
59
  # (nil if there is no repo_config for this platform for this build)
38
60
  def host_urls(host, build_details, build_url)
39
- packaging_platform = host[:packaging_platform]
61
+ packaging_platform = host_packaging_platform(host)
40
62
  if packaging_platform.nil?
41
63
  message = <<-EOF
42
64
  :packaging_platform not provided for host '#{host}', platform '#{host[:platform]}'
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '0.15.2'
2
+ VERSION = '0.16.0'
3
3
  end
@@ -78,6 +78,10 @@ describe ClassMixedWithDSLInstallUtils do
78
78
  details
79
79
  }
80
80
 
81
+ before :each do
82
+ allow( subject ).to receive( :host_packaging_platform ) { packaging_platform }
83
+ end
84
+
81
85
  it 'fails if there\'s no artifact value for the given platform' do
82
86
  allow( artifact_path ).to receive( :nil? ) { true }
83
87
  expect {
@@ -135,6 +139,41 @@ describe ClassMixedWithDSLInstallUtils do
135
139
 
136
140
  end
137
141
 
142
+ describe "#host_packaging_platform" do
143
+ let( :default_platform ) { 'default-platform' }
144
+ let( :overridden_platform ) { 'overridden-platform' }
145
+ let( :overrides ) { 'default-platform=overridden-platform' || @overrides }
146
+ let( :host ) {
147
+ host = hosts[0]
148
+ allow( host ).to receive( :[] ).with( :packaging_platform ) { default_platform }
149
+ allow( host ).to receive( :[] ).with( :platform ) { default_platform }
150
+ host
151
+ }
152
+
153
+ before :each do
154
+ @original_platforms = ENV['BEAKER_PACKAGING_PLATFORMS']
155
+ end
156
+
157
+ after :each do
158
+ ENV['BEAKER_PACKAGING_PLATFORMS'] = @original_platforms
159
+ end
160
+
161
+ it "applies an override to a platform" do
162
+ ENV['BEAKER_PACKAGING_PLATFORMS'] = overrides
163
+ expect(subject.host_packaging_platform(host)).to eq(overridden_platform)
164
+ end
165
+
166
+ it "applies a list of overrides to a platform" do
167
+ ENV['BEAKER_PACKAGING_PLATFORMS'] = "aix-7.1-power=aix-6.1-power,#{overrides}"
168
+ expect(subject.host_packaging_platform(host)).to eq(overridden_platform)
169
+ end
170
+
171
+ it "doesn't apply overrides if the current host's platform isn't overridden" do
172
+ ENV['BEAKER_PACKAGING_PLATFORMS'] = "aix-7.1-power=aix-6.1-power"
173
+ expect(subject.host_packaging_platform(host)).to eq(default_platform)
174
+ end
175
+ end
176
+
138
177
  describe '#install_artifact_on' do
139
178
 
140
179
  let( :artifact_url ) { 'url://in/the/jungle/lies/the/prize.pnc' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.6'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 0.14.0
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '0.6'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.14.0
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement