beaker-puppet 1.17.0 → 1.18.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: 59253ab3e53433cc50aa11fce2564472db5e2293
4
- data.tar.gz: df4b8cecf947cb8bd9681ca6cd2ece5225a6882c
3
+ metadata.gz: e36de0d3a26174df84e75c1aac59079ea1d29460
4
+ data.tar.gz: 4a9fc4ae22a19955d01a3ae73900dd9a634aa737
5
5
  SHA512:
6
- metadata.gz: 53bc876e2ac0677b22c564b163affc710c23b5ce27907e26354eaaa2d9c71b9f93dd9306a946b92d41de952f878985e6bb6a9618c6fe98326f626f3a93acbbbb
7
- data.tar.gz: 2828b53c02ca4c9111d06581c370e34dd985e0cd0080004be9e4f163f8d90b3d75758593c411f42c67d7811e4652de1e3ed9110b88777f8c313b6324a18a8711
6
+ metadata.gz: 441d745d701b6f5012d8f83e4c347efbb32da3e0aff93fa479d64a0f0598a0e4051f8f945a7d98110eb01bbc54ad23db26e9d1c48bd6486ca64742ec460ea70a
7
+ data.tar.gz: 7f2f7b46616579a86970ec13a727e9b472a33435e9e13d9de6e9d5f508ab881746d7ca24045c089585bb259a089b7e716df5073728f2651cc4fc4dc741fc988f
@@ -13,6 +13,7 @@ module Beaker
13
13
  :pe_promoted_builds_url => "http://pm.puppet.com",
14
14
  :release_apt_repo_url => "http://apt.puppet.com",
15
15
  :release_yum_repo_url => "http://yum.puppet.com",
16
+ :nightly_builds_url => "http://nightlies.puppet.com",
16
17
  :nightly_apt_repo_url => "http://nightlies.puppet.com/apt",
17
18
  :nightly_yum_repo_url => "http://nightlies.puppet.com/yum",
18
19
  :nightly_win_download_url => "http://nightlies.puppet.com/downloads/windows",
@@ -31,8 +31,22 @@ module Beaker
31
31
  # Github's ssh signature for cloning via ssh
32
32
  GitHubSig = 'github.com,207.97.227.239 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='
33
33
 
34
- # URL for public nightly builds
35
- DEFAULT_NIGHTLY_BUILDS_URL = 'http://nightlies.puppet.com'
34
+ # Merge given options with our default options in a consistent way
35
+ # This will remove any nil values so that we always have a set default.
36
+ #
37
+ # @param [Hash] the original options to be merged with the default options
38
+ #
39
+ # @return [Hash] The finalized set of options
40
+ def sanatize_opts(opts)
41
+ # If any of the nightly urls are not set, but the main `:nightly_builds_url`
42
+ # is set, we should overwrite anything not set.
43
+ opts[:nightly_apt_repo_url] ||= opts[:nightly_builds_url]
44
+ opts[:nightly_yum_repo_url] ||= opts[:nightly_builds_url]
45
+ opts[:nightly_win_download_url] ||= opts[:nightly_builds_url]
46
+ opts[:nightly_mac_download_url] ||= opts[:nightly_builds_url]
47
+
48
+ FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts.reject{|k,v| v.nil?})
49
+ end
36
50
 
37
51
  # lookup project-specific git environment variables
38
52
  # PROJECT_VAR or VAR otherwise return the default
@@ -45,17 +59,17 @@ module Beaker
45
59
  end
46
60
 
47
61
  # @return [Boolean] Whether Puppet's internal builds are accessible from all the SUTs
48
- def dev_builds_accessible?
62
+ def dev_builds_accessible?(url = FOSS_DEFAULT_DOWNLOAD_URLS[:dev_builds_url])
49
63
  block_on hosts do |host|
50
- return false unless dev_builds_accessible_on?(host)
64
+ return false unless dev_builds_accessible_on?(host, url)
51
65
  end
52
66
  true
53
67
  end
54
68
 
55
69
  # @param [Host] A beaker host
56
70
  # @return [Boolean] Whether Puppet's internal builds are accessible from the host
57
- def dev_builds_accessible_on?(host)
58
- result = on(host, %(curl -fI "#{Puppet5::DEFAULT_DEV_BUILDS_URL}"), accept_all_exit_codes: true)
71
+ def dev_builds_accessible_on?(host, url = FOSS_DEFAULT_DOWNLOAD_URLS[:dev_builds_url])
72
+ result = on(host, %(curl -fI "#{url}"), accept_all_exit_codes: true)
59
73
  return result.exit_code.zero?
60
74
  end
61
75
 
@@ -271,7 +285,7 @@ module Beaker
271
285
  # @raise [StandardError] When encountering an unsupported platform by default, or if gem cannot be found when default_action => 'gem_install'
272
286
  # @raise [FailTest] When error occurs during the actual installation process
273
287
  def install_puppet_on(hosts, opts = options)
274
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
288
+ opts = sanatize_opts(opts)
275
289
 
276
290
  # If version isn't specified assume the latest in the 3.x series
277
291
  if opts[:version] and not version_is_less(opts[:version], '4.0.0')
@@ -358,7 +372,7 @@ module Beaker
358
372
  # @raise [StandardError] When encountering an unsupported platform by default, or if gem cannot be found when default_action => 'gem_install'
359
373
  # @raise [FailTest] When error occurs during the actual installation process
360
374
  def install_puppet_agent_on(hosts, opts = {})
361
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
375
+ opts = sanatize_opts(opts)
362
376
  opts[:puppet_agent_version] ||= opts[:version] #backwards compatability with old parameter name
363
377
  opts[:puppet_collection] ||= puppet_collection_for(:puppet_agent, opts[:puppet_agent_version]) || 'pc1'
364
378
 
@@ -374,10 +388,21 @@ module Beaker
374
388
  package_name = nil
375
389
 
376
390
  # If inside the Puppet VPN, install from development builds.
377
- if opts[:puppet_agent_version] && dev_builds_accessible_on?(host)
391
+ if opts[:puppet_agent_version] && opts[:puppet_agent_version] != 'latest' && dev_builds_accessible_on?(host, opts[:dev_builds_url])
378
392
  return install_puppet_agent_from_dev_builds_on(host, opts[:puppet_agent_version])
379
393
  end
380
394
 
395
+ if opts[:puppet_agent_version] == 'latest'
396
+ opts[:puppet_collection] += '-nightly' unless opts[:puppet_collection].end_with? '-nightly'
397
+
398
+ # Since we have modified the collection, we don't want to pass `latest`
399
+ # in to `install_package` as the version. That'll fail. Instead, if
400
+ # we pass `nil`, `install_package` will just install the latest available
401
+ # package version from the enabled repo.
402
+ opts.delete(:puppet_agent_version)
403
+ opts.delete(:version)
404
+ end
405
+
381
406
  case host['platform']
382
407
  when /el-|redhat|fedora|sles|centos|cisco_/
383
408
  package_name = 'puppet-agent'
@@ -969,8 +994,8 @@ module Beaker
969
994
  def install_puppetlabs_release_repo_on( hosts, repo = nil, opts = options )
970
995
  block_on hosts do |host|
971
996
  variant, version, arch, codename = host['platform'].to_array
972
- repo_name = repo || opts[:puppet_collection] || ''
973
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
997
+ repo_name = repo || opts[:puppet_collection] || 'puppet'
998
+ opts = sanatize_opts(opts)
974
999
 
975
1000
  case variant
976
1001
  when /^(fedora|el|redhat|centos|sles|cisco_nexus|cisco_ios_xr)$/
@@ -989,11 +1014,10 @@ module Beaker
989
1014
  else
990
1015
  opts[:release_yum_repo_url]
991
1016
  end
992
- remote = "%s/%s/%s-release-%s-%s.noarch.rpm" %
993
- [url, repo_name, repo_name, variant_url_value, version]
1017
+ remote = "%s/%s-release-%s-%s.noarch.rpm" %
1018
+ [url, repo_name, variant_url_value, version]
994
1019
  else
995
- repo_name = '-' + repo_name unless repo_name.empty?
996
- remote = "%s/puppetlabs-release%s-%s-%s.noarch.rpm" %
1020
+ remote = "%s/%s-release-%s-%s.noarch.rpm" %
997
1021
  [opts[:release_yum_repo_url], repo_name, variant_url_value, version]
998
1022
  end
999
1023
 
@@ -1029,8 +1053,7 @@ module Beaker
1029
1053
  remote = "%s/%s-release-%s.deb" %
1030
1054
  [url, repo_name, codename]
1031
1055
  else
1032
- repo_name = '-' + repo_name unless repo_name.empty?
1033
- remote = "%s/puppetlabs-release%s-%s.deb" %
1056
+ remote = "%s/%s-release-%s.deb" %
1034
1057
  [opts[:release_apt_repo_url], repo_name, codename]
1035
1058
  end
1036
1059
 
@@ -1130,7 +1153,7 @@ module Beaker
1130
1153
  repo_configs_dir ||= 'tmp/repo_configs'
1131
1154
 
1132
1155
  platform_configs_dir = File.join(repo_configs_dir, variant)
1133
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1156
+ opts = sanatize_opts(opts)
1134
1157
 
1135
1158
  # some of the uses of dev_builds_url below can't include protocol info,
1136
1159
  # plus this opens up possibility of switching the behavior on provided
@@ -1224,7 +1247,7 @@ module Beaker
1224
1247
  # you could provide any values you could to one to the other
1225
1248
  puppet_agent_version = opts[:puppet_agent_sha] || opts[:puppet_agent_version]
1226
1249
 
1227
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1250
+ opts = sanatize_opts(opts)
1228
1251
  opts[:download_url] = "#{opts[:dev_builds_url]}/puppet-agent/#{ puppet_agent_version }/repos/"
1229
1252
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1230
1253
  opts[:puppet_collection] ||= 'PC1'
@@ -1323,7 +1346,7 @@ module Beaker
1323
1346
 
1324
1347
  block_on hosts do |host|
1325
1348
  pe_ver = host[:pe_ver] || opts[:pe_ver] || '4.0.0-rc1'
1326
- opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1349
+ opts = sanatize_opts(opts)
1327
1350
  opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos"
1328
1351
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1329
1352
  opts[:copy_dir_external] ||= host.external_copy_base
@@ -1383,32 +1406,33 @@ module Beaker
1383
1406
  # @param [Host] host A beaker host
1384
1407
  # @option opts [String] :version Specific puppetserver version.
1385
1408
  # If set, this overrides all other options and installs the specific
1386
- # version from Puppet's internal build servers.
1409
+ # version from Puppet's internal build servers or Puppet's public
1410
+ # release servers. If this version of puppetserver does not exist,
1411
+ # the install attempt will fail.
1387
1412
  # @option opts [Boolean] :nightlies Whether to install from nightlies.
1388
1413
  # Defaults to false.
1389
1414
  # @option opts [String] :release_stream Which release stream to install
1390
1415
  # repos from. Defaults to 'puppet', which installs the latest released
1391
1416
  # version. Other valid values are puppet5, puppet6.
1392
1417
  # @option opts [String] :nightly_builds_url Custom nightly builds URL.
1393
- # Defaults to {DEFAULT_NIGHTLY_BUILDS_URL}.
1394
- # @option opts [String] :yum_nightly_builds_url Custom nightly builds
1395
- # URL for yum. Defaults to {DEFAULT_NIGHTLY_BUILDS_URL}/yum when using
1396
- # the default :nightly_builds_url value. Otherwise, defaults to
1397
- # {DEFAULT_NIGHTLY_BUILDS_URL}.
1418
+ # Defaults to {FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_builds_url]}.
1419
+ # @option opts [String] :nightly_yum_builds_url Custom nightly builds
1420
+ # URL for yum. Defaults to {FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_yum_repo_url]}
1421
+ # or a custom defined :nightly_builds_url
1398
1422
  # @option opts [String] :apt_nightly_builds_url Custom nightly builds
1399
- # URL for apt. Defaults to {DEFAULT_NIGHTLY_BUILDS_URL}/apt when using
1400
- # the default :nightly_builds_url value. Otherwise, defaults to
1401
- # {DEFAULT_NIGHTLY_BUILDS_URL}.
1423
+ # URL for apt. Defaults to {FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_builds_url]}
1424
+ # or a custom defined :nightly_builds_url
1402
1425
  # @option opts [String] :dev_builds_url Custom internal builds URL.
1403
1426
  # Defaults to {DEFAULT_DEV_BUILDS_URL}.
1404
1427
  def install_puppetserver_on(host, opts = {})
1405
- # If the version is anything other than 'latest', install that specific version from internal dev builds
1406
- if opts[:version] && opts[:version].strip != 'latest'
1407
- dev_builds_url = opts[:dev_builds_url] || Puppet5::DEFAULT_DEV_BUILDS_URL
1408
- build_yaml_uri = %(#{dev_builds_url}/puppetserver/#{opts[:version]}/artifacts/#{opts[:version]}.yaml)
1409
- unless link_exists?(build_yaml_uri)
1410
- raise "Can't find a downloadable puppetserver package; metadata at #{build_yaml_uri} is missing or inaccessible."
1411
- end
1428
+ opts = sanatize_opts(opts)
1429
+
1430
+ # Default to installing latest from nightlies
1431
+ opts[:version] ||= 'latest'
1432
+
1433
+ # If inside the Puppet VPN, install from development builds.
1434
+ if opts[:version] && opts[:version] != 'latest' && dev_builds_accessible_on?(host, opts[:dev_builds_url])
1435
+ build_yaml_uri = %(#{opts[:dev_builds_url]}/puppetserver/#{opts[:version]}/artifacts/#{opts[:version]}.yaml)
1412
1436
  return install_from_build_data_url('puppetserver', build_yaml_uri, host)
1413
1437
  end
1414
1438
 
@@ -1424,28 +1448,24 @@ module Beaker
1424
1448
  # here would be incorrect - that refers to FOSS puppet 3 only).
1425
1449
  host[:type] = :aio
1426
1450
 
1427
- if opts[:nightlies]
1428
- release_stream += '-nightly'
1429
- # Determine the repo URLs; Use Puppet's nightly builds by default.
1430
- nightly_builds_url = opts[:nightly_builds_url] || DEFAULT_NIGHTLY_BUILDS_URL
1431
- if nightly_builds_url == DEFAULT_NIGHTLY_BUILDS_URL
1432
- # Puppet's nightlies need particular paths for these:
1433
- yum_nightly_builds_url = opts[:yum_nightly_builds_url] || nightly_builds_url + '/yum'
1434
- apt_nightly_builds_url = opts[:apt_nightly_builds_url] || nightly_builds_url + '/apt'
1435
- else
1436
- # If custom yum and apt urls are supplied, use them, otherwise
1437
- # just assume the nightly_builds_url is fine.
1438
- yum_nightly_builds_url = opts[:yum_nightly_builds_url] || nightly_builds_url
1439
- apt_nightly_builds_url = opts[:apt_nightly_builds_url] || nightly_builds_url
1440
- end
1441
- install_puppetlabs_release_repo_on(host, release_stream,
1442
- release_yum_repo_url: yum_nightly_builds_url,
1443
- release_apt_repo_url: apt_nightly_builds_url)
1444
- else
1445
- install_puppetlabs_release_repo_on(host, release_stream)
1451
+ if opts[:version] == 'latest' || opts[:nightlies]
1452
+ release_stream += '-nightly' unless release_stream.end_with? "-nightly"
1453
+
1454
+ # Since we have modified the collection, we don't want to pass `latest`
1455
+ # in to `install_package` as the version. That'll fail. Instead, if
1456
+ # we pass `nil`, `install_package` will just install the latest available
1457
+ # package version from the enabled repo.
1458
+ opts.delete(:version)
1459
+ end
1460
+
1461
+ # We have to do some silly version munging if we're on a deb-based platform
1462
+ case host['platform']
1463
+ when /debian|ubuntu|cumulus|huaweios/
1464
+ opts[:version] = "#{opts[:version]}-1#{host['platform'].codename}" if opts[:version]
1446
1465
  end
1447
1466
 
1448
- install_package(host, 'puppetserver')
1467
+ install_puppetlabs_release_repo_on(host, release_stream, opts)
1468
+ install_package(host, 'puppetserver', opts[:version])
1449
1469
 
1450
1470
  logger.notify("Installed puppetserver version #{puppetserver_version_on(host)} on #{host}")
1451
1471
  end
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.17.0'
2
+ VERSION = '1.18.0'
3
3
  end
@@ -1,24 +1,13 @@
1
- test_name "Install Packages" do
1
+ test_name "Install Puppet Agent Packages" do
2
2
 
3
- dev_builds_url = ENV['DEV_BUILDS_URL'] || 'http://builds.delivery.puppetlabs.net'
4
- nightly_builds_url = ENV['NIGHTLY_BUILDS_URL'] || 'http://nightlies.puppet.com'
3
+ opts = {
4
+ :nightly_builds_url => ENV['NIGHTLY_BUILDS_URL'],
5
+ :dev_builds_url => ENV['DEV_BUILDS_URL'],
6
+ :puppet_agent_version => ENV['SHA'],
7
+ :puppet_collection => ENV['RELEASE_STREAM']
8
+ }
5
9
 
6
- sha = ENV['SHA']
7
- release_stream = ENV['RELEASE_STREAM'] || 'puppet'
8
-
9
- step "Install puppet-agent..." do
10
- # If SHA='latest', then we're installing from nightlies
11
- if sha == 'latest'
12
- opts = {
13
- :release_yum_repo_url => nightly_builds_url + '/yum',
14
- :release_apt_repo_url => nightly_builds_url + '/apt',
15
- :puppet_collection => "#{release_stream}-nightly"
16
- }
17
- install_puppet_agent_on(hosts, opts)
18
- else
19
- install_from_build_data_url('puppet-agent', "#{dev_builds_url}/puppet-agent/#{sha}/artifacts/#{sha}.yaml", hosts)
20
- end
21
- end
10
+ install_puppet_agent_on(hosts, opts)
22
11
 
23
12
  # make sure install is sane, beaker has already added puppet and ruby
24
13
  # to PATH in ~/.ssh/environment
@@ -1,27 +1,11 @@
1
1
  test_name "Install Puppet Server" do
2
2
  skip_test "not testing with puppetserver" unless @options['is_puppetserver']
3
3
 
4
- server_version = ENV['SERVER_VERSION'] || 'latest'
5
- release_stream = ENV['RELEASE_STREAM'] || 'puppet'
6
- nightly_builds_url = ENV['NIGHTLY_BUILDS_URL'] || 'http://nightlies.puppet.com'
7
- dev_builds_url = ENV['DEV_BUILDS_URL'] || 'http://builds.delivery.puppetlabs.net'
8
-
9
- if nightly_builds_url == 'http://nightlies.puppet.com'
10
- yum_nightlies_url = nightly_builds_url + '/yum'
11
- apt_nightlies_url = nightly_builds_url + '/apt'
12
- else
13
- yum_nightlies_url = nightly_builds_url
14
- apt_nightlies_url = nightly_builds_url
15
- end
16
-
17
- if server_version == 'latest'
18
- opts = {
19
- :release_yum_repo_url => yum_nightlies_url,
20
- :release_apt_repo_url => apt_nightlies_url
21
- }
22
- install_puppetlabs_release_repo_on(master, "#{release_stream}-nightly", opts)
23
- master.install_package('puppetserver')
24
- else
25
- install_from_build_data_url('puppetserver', "#{dev_builds_url}/puppetserver/#{server_version}/artifacts/#{server_version}.yaml", master)
26
- end
4
+ opts = {
5
+ :version => ENV['SERVER_VERSION'],
6
+ :release_stream => ENV['RELEASE_STREAM'],
7
+ :nightly_builds_url => ENV['NIGHTLY_BUILDS_URL'],
8
+ :dev_builds_url => ENV['DEV_BUILDS_URL']
9
+ }
10
+ install_puppetserver_on(master, opts)
27
11
  end
@@ -71,6 +71,34 @@ describe ClassMixedWithDSLInstallUtils do
71
71
 
72
72
  let(:win_temp) { 'C:\\Windows\\Temp' }
73
73
 
74
+ context '#sanatize_opts' do
75
+ let(:opts) {
76
+ {
77
+ :win_download_url => nil,
78
+ :dev_builds_url => '',
79
+ :release_yum_repo_url => 'https://apt.customserver.net/apt'
80
+ }
81
+ }
82
+
83
+ it 'honors any custom values' do
84
+ expect( subject.sanatize_opts(opts)).to include({release_yum_repo_url: 'https://apt.customserver.net/apt'})
85
+ end
86
+
87
+ it 'overwrites any nil values with pre-defined defaults' do
88
+ default_win_url = described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:win_download_url]
89
+ expect( subject.sanatize_opts(opts)).to include({win_download_url: default_win_url})
90
+ end
91
+
92
+ it 'keeps empty strings' do
93
+ expect( subject.sanatize_opts(opts)).to include({dev_builds_url: ''})
94
+ end
95
+
96
+ it 'adds any undefined defaults' do
97
+ default_mac_url = described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:mac_download_url]
98
+ expect( subject.sanatize_opts(opts)).to include({mac_download_url: default_mac_url})
99
+ end
100
+ end
101
+
74
102
 
75
103
  context '#configure_foss_defaults_on' do
76
104
  it 'uses aio paths for hosts with role aio' do
@@ -455,7 +483,7 @@ describe ClassMixedWithDSLInstallUtils do
455
483
  context 'on el-6' do
456
484
  let(:platform) { Beaker::Platform.new('el-6-i386') }
457
485
  it 'installs' do
458
- expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-el-6\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
486
+ expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
459
487
  expect(hosts[0]).to receive(:install_package).with('puppet')
460
488
  subject.install_puppet
461
489
  end
@@ -463,7 +491,7 @@ describe ClassMixedWithDSLInstallUtils do
463
491
  InParallel::InParallelExecutor.logger = logger
464
492
  FakeFS.deactivate!
465
493
  hosts.each{ |host|
466
- allow(host).to receive(:install_package_with_rpm).with(/puppetlabs-release-el-6\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
494
+ allow(host).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
467
495
  allow(host).to receive(:install_package).with('puppet')
468
496
  }
469
497
  opts[:run_in_parallel] = true
@@ -485,7 +513,7 @@ describe ClassMixedWithDSLInstallUtils do
485
513
  context 'on el-5' do
486
514
  let(:platform) { Beaker::Platform.new('el-5-i386') }
487
515
  it 'installs' do
488
- expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-el-5\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
516
+ expect(hosts[0]).to receive(:install_package_with_rpm).with(%r{puppet-release-el-5.noarch.rpm}, '--replacepkgs', {:package_proxy=>false})
489
517
  expect(hosts[0]).to receive(:install_package).with('puppet')
490
518
  subject.install_puppet
491
519
  end
@@ -493,7 +521,7 @@ describe ClassMixedWithDSLInstallUtils do
493
521
  context 'on fedora' do
494
522
  let(:platform) { Beaker::Platform.new('fedora-18-x86_84') }
495
523
  it 'installs' do
496
- expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-fedora-18\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
524
+ expect(hosts[0]).to receive(:install_package_with_rpm).with(%r{puppet-release-fedora-18.noarch.rpm}, '--replacepkgs', {:package_proxy=>false})
497
525
  expect(hosts[0]).to receive(:install_package).with('puppet')
498
526
  subject.install_puppet
499
527
  end
@@ -697,21 +725,17 @@ describe ClassMixedWithDSLInstallUtils do
697
725
  context 'on el 7' do
698
726
  let( :platform ) { Beaker::Platform.new( 'el-7-x86_64' ) }
699
727
  it 'returns the correct url when repo is set to puppet8' do
700
- expect( host ).to receive( :install_package_with_rpm ).with( /puppet8\/puppet8-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
728
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppet8-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
701
729
  subject.install_puppetlabs_release_repo_on( host, 'puppet8')
702
730
  end
703
731
  it 'returns the correct url when opts[:puppet_collection] is set to puppet14' do
704
- expect( host ).to receive( :install_package_with_rpm ).with( /puppet14\/puppet14-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
732
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppet14-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
705
733
  subject.install_puppetlabs_release_repo_on( host, nil, {:puppet_collection => 'puppet14'})
706
734
  end
707
735
  it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
708
- expect( host ).to receive( :install_package_with_rpm ).with( /puppetlabs-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
736
+ expect( host ).to receive( :install_package_with_rpm ).with( /puppet-release-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
709
737
  subject.install_puppetlabs_release_repo_on( host )
710
738
  end
711
- it 'returns the correct url when repo is set to pc1' do
712
- expect( host ).to receive( :install_package_with_rpm ).with( /puppetlabs-release-pc1-el-7\.noarch\.rpm$/, '--replacepkgs', {:package_proxy=>false} )
713
- subject.install_puppetlabs_release_repo_on( host, 'pc1' )
714
- end
715
739
  end
716
740
 
717
741
  context 'on debian 8' do
@@ -729,17 +753,11 @@ describe ClassMixedWithDSLInstallUtils do
729
753
  subject.install_puppetlabs_release_repo_on( host, nil, {:puppet_collection => 'puppet7'} )
730
754
  end
731
755
  it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
732
- expect( subject ).to receive( :on ).with( host, /puppetlabs-release-jessie\.deb$/ ).once
756
+ expect( subject ).to receive( :on ).with( host, /puppet-release-jessie\.deb$/ ).once
733
757
  expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
734
758
  expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
735
759
  subject.install_puppetlabs_release_repo_on( host )
736
760
  end
737
- it 'returns the correct url when both repo is set to pc1' do
738
- expect( subject ).to receive( :on ).with( host, /puppetlabs-release-pc1-jessie\.deb$/ ).once
739
- expect( subject ).to receive( :on ).with( host, "dpkg -i --force-all /tmp/puppet.deb" ).once
740
- expect( subject ).to receive( :on ).with( host, "apt-get update" ).once
741
- subject.install_puppetlabs_release_repo_on( host, 'pc1' )
742
- end
743
761
  end
744
762
 
745
763
 
@@ -1448,9 +1466,9 @@ describe ClassMixedWithDSLInstallUtils do
1448
1466
  let(:host) { make_host('master', platform: 'el-7-x86_64') }
1449
1467
 
1450
1468
  context 'with default arguments' do
1451
- it "installs the latest puppetserver from the default 'puppet' release stream" do
1452
- expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet')
1453
- expect(subject).to receive(:install_package).with(host, 'puppetserver')
1469
+ it "installs the latest puppetserver from the default 'puppet-nightly' release stream" do
1470
+ expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet-nightly', include(nightly_yum_repo_url: "http://nightlies.puppet.com/yum"))
1471
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', nil)
1454
1472
  subject.install_puppetserver_on(host)
1455
1473
  end
1456
1474
  end
@@ -1458,46 +1476,61 @@ describe ClassMixedWithDSLInstallUtils do
1458
1476
  context 'with a version option' do
1459
1477
  version = '6.6.6'
1460
1478
 
1479
+ context 'on deb-based platform' do
1480
+ let(:host) {make_host('master', platform: Beaker::Platform.new('ubuntu-16.04-amd64'))}
1481
+ it 'munges the version on ubuntu 16.04' do
1482
+ expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet', anything)
1483
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', "#{version}-1xenial")
1484
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return false
1485
+ subject.install_puppetserver_on(host, version: version)
1486
+ end
1487
+ end
1488
+
1461
1489
  it 'installs puppetserver at the specific version from internal buildservers' do
1462
- expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{BeakerPuppet::DEFAULT_DEV_BUILDS_URL}.*#{version}/, host)
1463
- allow_any_instance_of(Beaker::DSL::WebHelpers).to receive(:link_exists?).and_return(true)
1490
+ expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:dev_builds_url]}.*#{version}/, host)
1491
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return true
1464
1492
  subject.install_puppetserver_on(host, version: version)
1465
1493
  end
1466
1494
 
1467
- context "and a YAML metadata file isn't accessible for it" do
1468
- it 'raises an exception' do
1469
- allow_any_instance_of(Beaker::DSL::WebHelpers).to receive(:link_exists?).and_return(false)
1470
- expect { subject.install_puppetserver_on(host, version: version) }.to raise_error(RuntimeError)
1471
- end
1495
+ it 'installs puppetserver from the custom dev builds URL' do
1496
+ dev_builds_url = 'http://builds.corp.tld'
1497
+ expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{dev_builds_url}.*#{version}/, host)
1498
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return true
1499
+ subject.install_puppetserver_on(host, version: version, dev_builds_url: dev_builds_url)
1472
1500
  end
1473
1501
 
1474
- context 'with a custom dev builds URL' do
1502
+ it 'installs puppetserver from the main repo if a broken url is passed in' do
1475
1503
  dev_builds_url = 'http://builds.corp.tld'
1476
-
1477
- it 'installs puppetserver from the custom dev builds URL' do
1478
- expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{dev_builds_url}.*#{version}/, host)
1479
- allow_any_instance_of(Beaker::DSL::WebHelpers).to receive(:link_exists?).and_return(true)
1480
- subject.install_puppetserver_on(host, version: version, dev_builds_url: dev_builds_url)
1481
- end
1504
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, dev_builds_url).and_return false
1505
+ expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet', include(version: '6.6.6'))
1506
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', '6.6.6')
1507
+ subject.install_puppetserver_on(host, version: version, dev_builds_url: dev_builds_url)
1482
1508
  end
1483
- end
1484
1509
 
1485
- context 'with a custom release stream option' do
1486
- it 'installs puppetserver from the custom release stream' do
1510
+ it 'installs from a custom release stream' do
1487
1511
  release_stream = 'puppet6'
1488
- expect(subject).to receive(:install_puppetlabs_release_repo_on)
1489
- .with(host, release_stream)
1490
- expect(subject).to receive(:install_package).with(host, 'puppetserver')
1491
- subject.install_puppetserver_on(host, release_stream: release_stream)
1512
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return false
1513
+ expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host,
1514
+ release_stream,
1515
+ include(version: '6.6.6'))
1516
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', '6.6.6')
1517
+ subject.install_puppetserver_on(host, release_stream: release_stream, version: version)
1518
+ end
1519
+
1520
+ it 'installs puppetserver from the default release stream' do
1521
+ allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return false
1522
+ expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet', include(version: '6.6.6'))
1523
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', '6.6.6')
1524
+ subject.install_puppetserver_on(host, version: version)
1492
1525
  end
1493
1526
  end
1494
1527
 
1495
1528
  context 'with the nightlies option' do
1496
1529
  it 'installs puppetserver from the default puppet nightly repos' do
1497
1530
  expect(subject).to receive(:install_puppetlabs_release_repo_on)
1498
- .with(host, 'puppet-nightly',
1499
- release_yum_repo_url: "#{BeakerPuppet::DEFAULT_NIGHTLY_BUILDS_URL}/yum",
1500
- release_apt_repo_url: "#{BeakerPuppet::DEFAULT_NIGHTLY_BUILDS_URL}/apt")
1531
+ .with(host, 'puppet-nightly', include(
1532
+ nightly_yum_repo_url: described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_yum_repo_url],
1533
+ nightly_apt_repo_url: described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_apt_repo_url]))
1501
1534
  subject.install_puppetserver_on(host, nightlies: true)
1502
1535
  end
1503
1536
 
@@ -1506,26 +1539,24 @@ describe ClassMixedWithDSLInstallUtils do
1506
1539
 
1507
1540
  it 'uses a custom general nightlies url' do
1508
1541
  expect(subject).to receive(:install_puppetlabs_release_repo_on)
1509
- .with(host, 'puppet-nightly',
1510
- release_yum_repo_url: custom_nightlies_url,
1511
- release_apt_repo_url: custom_nightlies_url)
1542
+ .with(host, 'puppet-nightly', include(
1543
+ nightly_yum_repo_url: custom_nightlies_url,
1544
+ nightly_apt_repo_url: custom_nightlies_url))
1512
1545
  subject.install_puppetserver_on(host, nightlies: true, nightly_builds_url: custom_nightlies_url)
1513
1546
  end
1514
1547
 
1515
1548
  it 'uses a custom yum repo url' do
1516
1549
  expect(subject).to receive(:install_puppetlabs_release_repo_on)
1517
- .with(host, 'puppet-nightly',
1518
- release_yum_repo_url: custom_nightlies_url,
1519
- release_apt_repo_url: "#{BeakerPuppet::DEFAULT_NIGHTLY_BUILDS_URL}/apt")
1520
- subject.install_puppetserver_on(host, nightlies: true, yum_nightly_builds_url: custom_nightlies_url)
1550
+ .with(host, 'puppet-nightly', include(
1551
+ nightly_yum_repo_url: custom_nightlies_url))
1552
+ subject.install_puppetserver_on(host, nightlies: true, nightly_yum_repo_url: custom_nightlies_url)
1521
1553
  end
1522
1554
 
1523
1555
  it 'uses a custom apt repo url' do
1524
1556
  expect(subject).to receive(:install_puppetlabs_release_repo_on)
1525
- .with(host, 'puppet-nightly',
1526
- release_yum_repo_url: "#{BeakerPuppet::DEFAULT_NIGHTLY_BUILDS_URL}/yum",
1527
- release_apt_repo_url: custom_nightlies_url)
1528
- subject.install_puppetserver_on(host, nightlies: true, apt_nightly_builds_url: custom_nightlies_url)
1557
+ .with(host, 'puppet-nightly', include(
1558
+ nightly_apt_repo_url: custom_nightlies_url))
1559
+ subject.install_puppetserver_on(host, nightlies: true, nightly_apt_repo_url: custom_nightlies_url)
1529
1560
  end
1530
1561
  end
1531
1562
  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.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-15 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec