beaker-puppet 1.0.1 → 1.1.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: 2eaf1431f3c69d52d3d5cca39a3ca55e1aa1107a
4
- data.tar.gz: 7bc51601fdeee7f6c989f631abe6fa5ff7d5719d
3
+ metadata.gz: a0c098df759909b2d7139e23776333e7f7da342c
4
+ data.tar.gz: ba69889bd92bbe1d47b7a5e0fe16b844aa7ad7b1
5
5
  SHA512:
6
- metadata.gz: 313ae2bb977c25c2c31b0469498d9006ef46ab7778ca9eb53fd94c9456bd8e11e29edeeaec0c4c473f8e241d4f23f85465fd9cf6b713cad4d85f0d19137832f2
7
- data.tar.gz: 735df403910919b2f6226a82ffbb107e50770908013126622266298d80b9aecc5f4507ba998e8259e322ffd6ffc9077302ebdf3bab3fa88b9c23df0bac65eda1
6
+ metadata.gz: 49299bd7b7715c3e50d0aaf79397c5add2a29dca58b76284266e5f2b8d4447532784abe943ca4013b77bd5533316385ee323ec3680fa2e0c1f257209986bd49e
7
+ data.tar.gz: 50e8a96e4e5ebf3951aaf823436999374e18229b6359900a000c7fd1b4881234a1e3a4c9af8c8d1abbbc9bb2968e59d637597aacf050afea8f87d4b1f1c140f2
@@ -1293,7 +1293,7 @@ module Beaker
1293
1293
  opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos"
1294
1294
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1295
1295
  opts[:copy_dir_external] ||= host.external_copy_base
1296
- opts[:puppet_collection] ||= 'PC1'
1296
+ opts[:puppet_collection] ||= get_puppet_collection(opts[:puppet_agent_version])
1297
1297
  add_role(host, 'aio') #we are installing agent, so we want aio role
1298
1298
  release_path = opts[:download_url]
1299
1299
  variant, version, arch, codename = host['platform'].to_array
@@ -72,6 +72,20 @@ module Beaker
72
72
  end
73
73
  end
74
74
 
75
+ #Given an agent_version, return the puppet collection associated with that agent version
76
+ #@param [String] agent_version version string or 'latest'
77
+ def get_puppet_collection(agent_version = 'latest')
78
+ collection = "PC1"
79
+ if agent_version != 'latest'
80
+ if ! version_is_less( agent_version, "5.5.4") and version_is_less(agent_version, "5.99")
81
+ collection = "puppet5"
82
+ elsif ! version_is_less( agent_version, "5.99")
83
+ collection = "puppet6"
84
+ end
85
+ end
86
+ collection
87
+ end
88
+
75
89
  #Configure the provided hosts to be of the provided type (one of foss, aio, pe), if the host
76
90
  #is already associated with a type then remove the previous settings for that type
77
91
  # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -955,12 +955,6 @@ describe ClassMixedWithDSLInstallUtils do
955
955
  expect( host['dist'] ).to be == "puppet-agent-VERSION-x64"
956
956
 
957
957
  end
958
- end
959
-
960
- describe '#install_puppet_agent_pe_promoted_repo_on' do
961
-
962
-
963
-
964
958
  end
965
959
 
966
960
  describe '#install_cert_on_windows' do
@@ -1353,6 +1347,62 @@ describe ClassMixedWithDSLInstallUtils do
1353
1347
  it 'calls fetch_http_file with no ending slash' do
1354
1348
  test_fetch_http_file_no_ending_slash( 'debian-5-x86_64' )
1355
1349
  end
1350
+
1351
+ context 'when setting different agent versions' do
1352
+ let( :host ) { basic_hosts.first }
1353
+ let( :platform ) { Object.new() }
1354
+ let( :downloadurl ) { 'http://pm.puppetlabs.com' }
1355
+ before :each do
1356
+ allow( platform ).to receive( :to_array ) { ['el', '6', 'x4'] }
1357
+ allow( subject ).to receive( :options ).and_return( opts )
1358
+ allow( subject ).to receive( :scp_to )
1359
+ allow( subject ).to receive( :configure_type_defaults_on ).with( host )
1360
+ end
1361
+
1362
+ it 'sets correct file paths when agent version is set to latest' do
1363
+ host['platform'] = platform
1364
+ agentversion = 'latest'
1365
+ collection = 'PC1'
1366
+ opts = { :puppet_agent_version => "#{agentversion}" , :pe_promoted_builds_url => "#{downloadurl}" }
1367
+
1368
+ expect( subject ).to receive( :fetch_http_file ).once.with( /pm\.puppetlabs\.com\/puppet-agent\/.*\/#{agentversion}\/repos/, /puppet-agent-el-6*/, /\/el$/ )
1369
+ expect( host).to receive( :pe_puppet_agent_promoted_package_install ).with( anything, /puppet-agent-el-6*/, /.*\/el\/6\/#{collection}\/.*rpm/, /puppet-agent-el-6/, anything )
1370
+ subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
1371
+ end
1372
+
1373
+ it 'sets correct file paths for agent version < 5.5.4' do
1374
+ host['platform'] = platform
1375
+ agentversion = '5.3.3'
1376
+ collection = 'PC1'
1377
+ opts = { :puppet_agent_version => "#{agentversion}" , :pe_promoted_builds_url => "#{downloadurl}"}
1378
+
1379
+ expect( subject ).to receive( :fetch_http_file ).once.with( /pm\.puppetlabs\.com\/puppet-agent\/.*\/#{agentversion}\/repos/, /puppet-agent-el-6*/, /\/el$/ )
1380
+ expect( host).to receive( :pe_puppet_agent_promoted_package_install ).with( anything, /puppet-agent-el-6*/, /.*\/el\/6\/#{collection}\/.*rpm/, /puppet-agent-el-6/, anything )
1381
+ subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
1382
+ end
1383
+
1384
+ it 'sets correct file paths for agent version >= 5.5.4' do
1385
+ host['platform'] = platform
1386
+ agentversion = '5.5.4'
1387
+ collection = 'puppet5'
1388
+ opts = { :puppet_agent_version => "#{agentversion}" , :pe_promoted_builds_url => "#{downloadurl}"}
1389
+
1390
+ expect( subject ).to receive( :fetch_http_file ).once.with( /pm\.puppetlabs\.com\/puppet-agent\/.*\/#{agentversion}\/repos/, /puppet-agent-el-6*/, /\/el$/ )
1391
+ expect( host).to receive( :pe_puppet_agent_promoted_package_install ).with( anything, /puppet-agent-el-6*/, /.*\/el\/6\/#{collection}\/.*rpm/, /puppet-agent-el-6/, anything )
1392
+ subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
1393
+ end
1394
+
1395
+ it 'sets correct file paths for agent version > 5.99' do
1396
+ host['platform'] = platform
1397
+ agentversion = '6.0'
1398
+ collection = 'puppet6'
1399
+ opts = { :puppet_agent_version => "#{agentversion}" , :pe_promoted_builds_url => "#{downloadurl}"}
1400
+
1401
+ expect( subject ).to receive( :fetch_http_file ).once.with( /pm\.puppetlabs\.com\/puppet-agent\/.*\/#{agentversion}\/repos/, /puppet-agent-el-6*/, /\/el$/ )
1402
+ expect( host).to receive( :pe_puppet_agent_promoted_package_install ).with( anything, /puppet-agent-el-6*/, /.*\/el\/6\/#{collection}\/.*rpm/, /puppet-agent-el-6/, anything )
1403
+ subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
1404
+ end
1405
+ end
1356
1406
  end
1357
1407
 
1358
1408
  describe '#remove_puppet_on' do
@@ -136,4 +136,20 @@ describe ClassMixedWithDSLInstallUtils do
136
136
  end
137
137
 
138
138
  end
139
+
140
+ describe "get_puppet_collection" do
141
+ it "receives agent_version 'latest' and return collection 'PC1'" do
142
+ expect(subject.get_puppet_collection('latest')).to eq('PC1')
143
+ end
144
+ it "receives agent_version between 5.5.4 and 5.99 and return collection 'puppet5'" do
145
+ expect(subject.get_puppet_collection('5.5.4')).to eq('puppet5')
146
+ end
147
+ it "receives agent_version greater than 5.99 and return collection 'puppet6'" do
148
+ expect(subject.get_puppet_collection('6.0')).to eq('puppet6')
149
+ end
150
+ it "receives agent_version less than 5.5.4 and return collection 'PC1'" do
151
+ expect(subject.get_puppet_collection('3.0')).to eq('PC1')
152
+ end
153
+ end
154
+
139
155
  end
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: 1.0.1
4
+ version: 1.1.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-08-10 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec