beaker-puppet 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -189,7 +189,7 @@ else
189
189
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
190
190
  config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
191
191
  config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
192
- config.user = 'voxpupuli'
192
+ config.user = 'puppetlabs'
193
193
  config.project = 'beaker-puppet'
194
194
  config.future_release = "#{Gem::Specification.load("#{config.project}.gemspec").version}"
195
195
  end
@@ -29,6 +29,6 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'beaker-vmpooler', '~> 1.4'
30
30
 
31
31
  # Run time dependencies
32
- s.add_runtime_dependency 'beaker', '~> 5.0'
32
+ s.add_runtime_dependency 'beaker', '>= 5.0', '< 7'
33
33
  s.add_runtime_dependency 'oga', '~> 3.4'
34
34
  end
@@ -303,7 +303,7 @@ module Beaker
303
303
  family = ::Regexp.last_match(1)
304
304
  relver = ::Regexp.last_match(2)
305
305
  install_puppet_from_rpm_on(host, opts.merge(release: relver, family: family))
306
- elsif host['platform'] =~ /(ubuntu|debian|huaweios)/
306
+ elsif host['platform'] =~ /(ubuntu|debian)/
307
307
  install_puppet_from_deb_on(host, opts)
308
308
  elsif host['platform'] =~ /windows/
309
309
  relver = opts[:version]
@@ -406,10 +406,10 @@ module Beaker
406
406
  end
407
407
 
408
408
  case host['platform']
409
- when /amazon|el-|redhat|fedora|sles|centos|cisco_/
409
+ when /amazon|el-|redhat|fedora|sles|centos/
410
410
  package_name = 'puppet-agent'
411
411
  package_name << "-#{opts[:puppet_agent_version]}" if opts[:puppet_agent_version]
412
- when /debian|ubuntu|huaweios/
412
+ when /debian|ubuntu/
413
413
  package_name = 'puppet-agent'
414
414
  if opts[:puppet_agent_version]
415
415
  package_name << "=#{opts[:puppet_agent_version]}-1#{host['platform'].codename}"
@@ -921,9 +921,9 @@ module Beaker
921
921
 
922
922
  unless host.check_for_command('gem')
923
923
  gempkg = case host['platform']
924
- when /solaris-11/ then 'ruby-18'
925
- when /ubuntu-14/ then 'ruby'
926
- when /solaris-10|ubuntu|debian|el-|huaweios/ then 'rubygems'
924
+ when /solaris-11/ then 'ruby-18'
925
+ when /ubuntu-14/ then 'ruby'
926
+ when /solaris-10|ubuntu|debian|el-/ then 'rubygems'
927
927
  when /openbsd/ then 'ruby'
928
928
  else
929
929
  raise 'install_puppet() called with default_action ' +
@@ -937,7 +937,7 @@ module Beaker
937
937
  # Link 'gem' to /usr/bin instead of adding /opt/csw/bin to PATH.
938
938
  on host, 'ln -s /opt/csw/bin/gem /usr/bin/gem' if is_solaris10
939
939
 
940
- if host['platform'] =~ /debian|ubuntu|solaris|huaweios/
940
+ if host['platform'] =~ /debian|ubuntu|solaris/
941
941
  gem_env = YAML.load(on(host, 'gem environment').stdout)
942
942
  gem_paths_array = gem_env['RubyGems Environment'].find { |h| h['GEM PATHS'] != nil }['GEM PATHS']
943
943
  path_with_gem = 'export PATH=' + gem_paths_array.join(':') + ':${PATH}'
@@ -993,16 +993,8 @@ module Beaker
993
993
  opts = sanitize_opts(opts)
994
994
 
995
995
  case variant
996
- when /^(amazon|fedora|el|redhat|centos|sles|cisco_nexus|cisco_ios_xr)$/
996
+ when /^(amazon|fedora|el|redhat|centos|sles)$/
997
997
  variant_url_value = (%w[redhat centos].include?(::Regexp.last_match(1)) ? 'el' : ::Regexp.last_match(1))
998
- if variant == 'cisco_nexus'
999
- variant_url_value = 'cisco-wrlinux'
1000
- version = '5'
1001
- end
1002
- if variant == 'cisco_ios_xr'
1003
- variant_url_value = 'cisco-wrlinux'
1004
- version = '7'
1005
- end
1006
998
  if repo_name.match(/puppet\d*/)
1007
999
  url = if repo_name.match(/-nightly$/)
1008
1000
  opts[:nightly_yum_repo_url]
@@ -1028,19 +1020,11 @@ module Beaker
1028
1020
  end
1029
1021
  end
1030
1022
 
1031
- if variant == 'cisco_nexus'
1032
- # cisco nexus requires using yum to install the repo
1033
- host.install_package(remote)
1034
- elsif variant == 'cisco_ios_xr'
1035
- # cisco ios xr requires using yum to localinstall the repo
1036
- on host, "yum -y localinstall #{remote}"
1037
- else
1038
- opts[:package_proxy] ||= false
1039
- host.install_package_with_rpm(remote, '--replacepkgs',
1040
- { package_proxy: opts[:package_proxy] })
1041
- end
1023
+ opts[:package_proxy] ||= false
1024
+ host.install_package_with_rpm(remote, '--replacepkgs',
1025
+ { package_proxy: opts[:package_proxy] })
1042
1026
 
1043
- when /^(debian|ubuntu|huaweios)$/
1027
+ when /^(debian|ubuntu)$/
1044
1028
  if repo_name.match(/puppet\d*/)
1045
1029
  url = if repo_name.match(/-nightly$/)
1046
1030
  opts[:nightly_apt_repo_url]
@@ -1111,14 +1095,10 @@ module Beaker
1111
1095
  File.write(repo, contents)
1112
1096
  end
1113
1097
 
1114
- to_path = if host[:platform] =~ /cisco_nexus/
1115
- "#{host.package_config_dir}/#{File.basename(repo)}"
1116
- else
1117
- host.package_config_dir
1118
- end
1098
+ to_path = host.package_config_dir
1119
1099
  scp_to(host, repo, to_path)
1120
1100
 
1121
- on(host, 'apt-get update') if host['platform'] =~ /ubuntu-|debian-|huaweios-/
1101
+ on(host, 'apt-get update') if host['platform'] =~ /ubuntu-|debian-/
1122
1102
  nil
1123
1103
  end
1124
1104
 
@@ -1148,7 +1128,7 @@ module Beaker
1148
1128
  repo_configs_dir = nil,
1149
1129
  opts = options)
1150
1130
  variant, version, arch, codename = host['platform'].to_array
1151
- if variant !~ /^(fedora|el|redhat|centos|debian|ubuntu|huaweios|cisco_nexus|cisco_ios_xr|sles)$/
1131
+ if variant !~ /^(amazon|fedora|el|redhat|centos|debian|ubuntu|sles)$/
1152
1132
  raise "No repository installation step for #{variant} yet..."
1153
1133
  end
1154
1134
 
@@ -1162,7 +1142,7 @@ module Beaker
1162
1142
  # url type
1163
1143
  _, protocol, hostname = opts[:dev_builds_url].partition %r{.*://}
1164
1144
  dev_builds_url = protocol + hostname
1165
- dev_builds_url = opts[:dev_builds_url] if variant =~ /^(fedora|el|redhat|centos)$/
1145
+ dev_builds_url = opts[:dev_builds_url] if variant =~ /^(amazon|fedora|el|redhat|centos)$/
1166
1146
 
1167
1147
  install_repo_configs(host, dev_builds_url, package_name,
1168
1148
  build_version, platform_configs_dir)
@@ -1181,7 +1161,7 @@ module Beaker
1181
1161
  # @note This method is paired to be run directly after {#install_puppetlabs_dev_repo}
1182
1162
  #
1183
1163
  def install_packages_from_local_dev_repo(host, package_name)
1184
- if host['platform'] =~ /debian|ubuntu|huaweios/
1164
+ if host['platform'] =~ /debian|ubuntu/
1185
1165
  find_filename = '*.deb'
1186
1166
  find_command = 'dpkg -i'
1187
1167
  elsif host['platform'] =~ /fedora|el|redhat|centos/
@@ -1269,7 +1249,7 @@ module Beaker
1269
1249
 
1270
1250
  # We have to do some silly version munging if we're on a deb-based platform
1271
1251
  case host['platform']
1272
- when /debian|ubuntu|huaweios/
1252
+ when /debian|ubuntu/
1273
1253
  opts[:version] = "#{opts[:version]}-1#{host['platform'].codename}" if opts[:version]
1274
1254
  end
1275
1255
 
@@ -1291,7 +1271,7 @@ module Beaker
1291
1271
  cmdline_args = ''
1292
1272
  # query packages
1293
1273
  case host[:platform]
1294
- when /huaweios|ubuntu/
1274
+ when /ubuntu/
1295
1275
  pkgs = on(host, "dpkg-query -l | awk '{print $2}' | grep -E '(^pe-|puppet)'",
1296
1276
  acceptable_exit_codes: [0, 1]).stdout.chomp.split(/\n+/)
1297
1277
  when /aix|sles|el|redhat|centos|oracle|scientific/
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '3.0.0'
2
+ VERSION = '4.0.0'
3
3
  end
@@ -818,48 +818,6 @@ describe ClassMixedWithDSLInstallUtils do
818
818
  subject.install_puppetlabs_release_repo_on(host)
819
819
  end
820
820
  end
821
-
822
- context 'on debian 8' do
823
- let(:platform) { Beaker::Platform.new('debian-8-i386') }
824
- it 'returns the correct url when repo is set to puppet4' do
825
- expect(subject).to receive(:on).with(host, /puppet4-release-jessie\.deb$/).once
826
- expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
827
- expect(subject).to receive(:on).with(host, 'apt-get update').once
828
- subject.install_puppetlabs_release_repo_on(host, 'puppet4')
829
- end
830
- it 'returns the correct url when opts[:puppet_collection] is set to puppet7' do
831
- expect(subject).to receive(:on).with(host, /puppet7-release-jessie\.deb$/).once
832
- expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
833
- expect(subject).to receive(:on).with(host, 'apt-get update').once
834
- subject.install_puppetlabs_release_repo_on(host, nil, { puppet_collection: 'puppet7' })
835
- end
836
- it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
837
- expect(subject).to receive(:on).with(host, /puppet-release-jessie\.deb$/).once
838
- expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
839
- expect(subject).to receive(:on).with(host, 'apt-get update').once
840
- subject.install_puppetlabs_release_repo_on(host)
841
- end
842
- end
843
-
844
- context 'on cisco platforms' do
845
- context 'version 5' do
846
- let(:platform) { Beaker::Platform.new('cisco_nexus-7-x86_64') }
847
-
848
- it 'calls host.install_package' do
849
- expect(host).to receive(:install_package).with(/\.rpm$/)
850
- subject.install_puppetlabs_release_repo_on(host)
851
- end
852
- end
853
-
854
- context 'version 7' do
855
- let(:platform) { Beaker::Platform.new('cisco_ios_xr-6-x86_64') }
856
-
857
- it 'uses yum localinstall to install the package' do
858
- expect(subject).to receive(:on).with(host, /^yum.*localinstall.*\.rpm$/)
859
- subject.install_puppetlabs_release_repo_on(host)
860
- end
861
- end
862
- end
863
821
  end
864
822
 
865
823
  describe '#install_puppetlabs_dev_repo' do
@@ -884,6 +842,8 @@ describe ClassMixedWithDSLInstallUtils do
884
842
  allow(rez).to receive(:exit_code) { 0 }
885
843
  allow(subject).to receive(:link_exists?).and_return(true)
886
844
  expect(subject).to receive(:scp_to).with(host, repo_config, /.*/).ordered
845
+ allow(File).to receive(:read).and_call_original
846
+ allow(File).to receive(:read).with('repoconfig').and_return('')
887
847
  subject.install_puppetlabs_dev_repo host, package_name, package_version
888
848
  end
889
849
  end
@@ -960,7 +920,7 @@ describe ClassMixedWithDSLInstallUtils do
960
920
  end
961
921
 
962
922
  it 'fails correctly for systems not accounted for' do
963
- @platform = 'eos-1-3'
923
+ @platform = 'freebsd-1-3'
964
924
  expect { subject.install_packages_from_local_dev_repo(host, package_name) }.to raise_error RuntimeError
965
925
  end
966
926
  end
@@ -1108,10 +1068,10 @@ describe ClassMixedWithDSLInstallUtils do
1108
1068
  version = '6.6.6'
1109
1069
 
1110
1070
  context 'on deb-based platform' do
1111
- let(:host) { make_host('master', platform: Beaker::Platform.new('ubuntu-16.04-amd64')) }
1112
- it 'munges the version on ubuntu 16.04' do
1071
+ let(:host) { make_host('master', platform: Beaker::Platform.new('ubuntu-24.04-amd64')) }
1072
+ it 'munges the version on ubuntu 24.04' do
1113
1073
  expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet', anything)
1114
- expect(subject).to receive(:install_package).with(host, 'puppetserver', "#{version}-1xenial")
1074
+ expect(subject).to receive(:install_package).with(host, 'puppetserver', "#{version}-1noble")
1115
1075
  allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return false
1116
1076
  subject.install_puppetserver_on(host, version: version)
1117
1077
  end
data/spec/helpers.rb CHANGED
@@ -120,9 +120,7 @@ module HostHelpers
120
120
  end
121
121
 
122
122
  module PlatformHelpers
123
- DEBIANPLATFORMS = %w[debian
124
- ubuntu
125
- huaweios]
123
+ DEBIANPLATFORMS = %w[debian ubuntu]
126
124
 
127
125
  FEDORASYSTEMD = (14..29).to_a.collect! { |i| "fedora-#{i}" }
128
126
 
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: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-14 00:00:00.000000000 Z
11
+ date: 2024-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs
@@ -104,16 +104,22 @@ dependencies:
104
104
  name: beaker
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '5.0'
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: '7'
110
113
  type: :runtime
111
114
  prerelease: false
112
115
  version_requirements: !ruby/object:Gem::Requirement
113
116
  requirements:
114
- - - "~>"
117
+ - - ">="
115
118
  - !ruby/object:Gem::Version
116
119
  version: '5.0'
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '7'
117
123
  - !ruby/object:Gem::Dependency
118
124
  name: oga
119
125
  requirement: !ruby/object:Gem::Requirement