beaker 4.33.0 → 4.34.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
  SHA256:
3
- metadata.gz: 616dad30c0a52596729122a76480319c8de41481e0db2eda6a8928d749753ebc
4
- data.tar.gz: b2576fdfc69863c773cf6f1bf4680abdf37ff9dcec1d1181197b63a5ddcbb480
3
+ metadata.gz: bc022311d195fb3d0b0ff1b9b957272379e6adc5aadb1dfb30e77d89a912872d
4
+ data.tar.gz: be60dbf2c333ea695d3e6d8b4b8fd5dc6811acbe6489e17cf924b08f24c79b05
5
5
  SHA512:
6
- metadata.gz: 4275553bc11bdf88c2d61362ef90b7ae4ebbf4d9edefa7dd425047749b15c71c66d793c9f1cdc6177aa1f8ccbddeb7753415cc20095ca561825c1731cf4130e8
7
- data.tar.gz: 3c84ade543f27139069dd163634a0bd531a22f8c9c397450f32d102d609ebd2023e1c89dea7074a00da05d5bd8f95965c5f1895c69d845942ef7b4bcc2ca81a2
6
+ metadata.gz: '0287d90c4f88b325f104eb4dd36ad8d75f26f070c2851d4bec00c364ee3150fc706902667ecd14f1e127cd5e4030d8a418ce0dccbe9a6ec9f58dbdd08a81a1de'
7
+ data.tar.gz: 8db6cc489d03e57bf25f373cd20dbc1c99b3d1eebbd7108191bd133e3152f61b8333a8f24667f7ed24c29ba4f29242bfaa5c016c24d380a11c24cb0c3207d942
data/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.34.0](https://github.com/voxpupuli/beaker/tree/4.34.0) (2022-01-27)
4
+
5
+ ### Added
6
+
7
+ - Extract a host_packages method from validate_host ([#1729](https://github.com/voxpupuli/beaker/pull/1729))
8
+ - Reduce duplication in ssh_permit_user_environment ([#1728](https://github.com/voxpupuli/beaker/pull/1728))
9
+
10
+ ### Fixed
11
+
12
+ - Do not install curl on EL9 ([#1728](https://github.com/voxpupuli/beaker/pull/1732))
13
+ - Drop old Ruby 1.8 compatibility code ([#1728](https://github.com/voxpupuli/beaker/pull/1730))
14
+
3
15
  ## [4.33.0](https://github.com/voxpupuli/beaker/tree/4.33.0) (2022-01-21)
4
16
 
5
17
  ### Added
6
18
 
7
- - Add ed25519 ad runtime dependency ([#1726](https://github.com/voxpupuli/beaker/pull/1726))
19
+ - Add ed25519 as runtime dependency ([#1726](https://github.com/voxpupuli/beaker/pull/1726))
8
20
 
9
21
  ## [4.32.0](https://github.com/voxpupuli/beaker/tree/4.32.0) (2021-12-06)
10
22
 
@@ -302,29 +302,11 @@ module Unix::Exec
302
302
  # (from {#ssh_service_restart}).
303
303
  def ssh_permit_user_environment
304
304
  case self['platform']
305
- when /debian|ubuntu|cumulus|huaweios|archlinux/
305
+ when /debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/
306
306
  directory = tmpdir()
307
307
  exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
308
308
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
309
309
  exec(Beaker::Command.new("echo '' >/etc/environment")) if self['platform'] =~ /ubuntu-20.04/
310
- when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7|el-8|centos-8|redhat-8|oracle-8/
311
- directory = tmpdir()
312
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
313
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
314
- when /el-|centos|fedora|redhat|oracle|scientific|eos/
315
- directory = tmpdir()
316
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
317
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
318
- when /opensuse|sles/
319
- directory = tmpdir()
320
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
321
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
322
- when /solaris/
323
- # kept solaris here because refactoring it into its own Host module
324
- # conflicts with the solaris hypervisor that already exists
325
- directory = tmpdir()
326
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
327
- exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
328
310
  when /(free|open)bsd/
329
311
  exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
330
312
  else
@@ -13,6 +13,7 @@ module Beaker
13
13
  SLEEPWAIT = 5
14
14
  TRIES = 5
15
15
  RHEL8_PACKAGES = ['curl', 'chrony']
16
+ RHEL9_PACKAGES = ['chrony']
16
17
  FEDORA_PACKAGES = ['curl', 'chrony']
17
18
  UNIX_PACKAGES = ['curl', 'ntpdate']
18
19
  FREEBSD_PACKAGES = ['curl', 'perl5|perl']
@@ -101,42 +102,58 @@ module Beaker
101
102
  def validate_host host, opts
102
103
  logger = opts[:logger]
103
104
  block_on host do |host|
104
- case
105
- when host['platform'] =~ /el-[89]/
106
- check_and_install_packages_if_needed(host, RHEL8_PACKAGES)
107
- when host['platform'] =~ /sles-10/
108
- check_and_install_packages_if_needed(host, SLES10_PACKAGES)
109
- when host['platform'] =~ /opensuse|sles-/
110
- check_and_install_packages_if_needed(host, SLES_PACKAGES)
111
- when host['platform'] =~ /debian/
112
- check_and_install_packages_if_needed(host, DEBIAN_PACKAGES)
113
- when host['platform'] =~ /cumulus/
114
- check_and_install_packages_if_needed(host, CUMULUS_PACKAGES)
115
- when (host['platform'] =~ /windows/ and host.is_cygwin?)
116
- raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
117
- check_and_install_packages_if_needed(host, WINDOWS_PACKAGES)
118
- when (host['platform'] =~ /windows/ and not host.is_cygwin?)
119
- check_and_install_packages_if_needed(host, PSWINDOWS_PACKAGES)
120
- when host['platform'] =~ /freebsd/
121
- check_and_install_packages_if_needed(host, FREEBSD_PACKAGES)
122
- when host['platform'] =~ /openbsd/
123
- check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
124
- when host['platform'] =~ /solaris-10/
125
- check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
126
- when host['platform'] =~ /solaris-1[1-9]/
127
- check_and_install_packages_if_needed(host, SOLARIS11_PACKAGES)
128
- when host['platform'] =~ /archlinux/
129
- check_and_install_packages_if_needed(host, ARCHLINUX_PACKAGES)
130
- when host['platform'] =~ /fedora/
131
- check_and_install_packages_if_needed(host, FEDORA_PACKAGES)
132
- when host['platform'] !~ /debian|aix|solaris|windows|opensuse-|sles-|osx-|cumulus|f5-|netscaler|cisco_/
133
- check_and_install_packages_if_needed(host, UNIX_PACKAGES)
134
- end
105
+ check_and_install_packages_if_needed(host, host_packages(host))
135
106
  end
136
107
  rescue => e
137
108
  report_and_raise(logger, e, "validate")
138
109
  end
139
110
 
111
+ # Return a list of packages that should be present.
112
+ #
113
+ # @param [Host] host A host return the packages for
114
+ # @return [Array<String>] A list of packages to install
115
+ def host_packages(host)
116
+ case host['platform']
117
+ when /el-8/
118
+ RHEL8_PACKAGES
119
+ when /el-9/
120
+ RHEL9_PACKAGES
121
+ when /sles-10/
122
+ SLES10_PACKAGES
123
+ when /opensuse|sles-/
124
+ SLES_PACKAGES
125
+ when /debian/
126
+ DEBIAN_PACKAGES
127
+ when /cumulus/
128
+ CUMULUS_PACKAGES
129
+ when /windows/
130
+ if host.is_cygwin?
131
+ raise RuntimeError, "cygwin is not installed on #{host}" if !host.cygwin_installed?
132
+ WINDOWS_PACKAGES
133
+ else
134
+ PSWINDOWS_PACKAGES
135
+ end
136
+ when /freebsd/
137
+ FREEBSD_PACKAGES
138
+ when /openbsd/
139
+ OPENBSD_PACKAGES
140
+ when /solaris-10/
141
+ SOLARIS10_PACKAGES
142
+ when /solaris-1[1-9]/
143
+ SOLARIS11_PACKAGES
144
+ when /archlinux/
145
+ ARCHLINUX_PACKAGES
146
+ when /fedora/
147
+ FEDORA_PACKAGES
148
+ else
149
+ if host['platform'] !~ /aix|solaris|osx-|f5-|netscaler|cisco_/
150
+ UNIX_PACKAGES
151
+ else
152
+ []
153
+ end
154
+ end
155
+ end
156
+
140
157
  # Installs the given packages if they aren't already on a host
141
158
  #
142
159
  # @param [Host] host Host to act on
@@ -130,14 +130,5 @@ module Beaker
130
130
  def with_version_number
131
131
  [@variant, @version, @arch].join('-')
132
132
  end
133
-
134
- if RUBY_VERSION =~ /^1\.9/
135
- def init_with(coder)
136
- coder.map.each do |ivar, value|
137
- instance_variable_set("@#{ivar}", value)
138
- end
139
- replace("#{@variant}-#{@version}-#{@arch}")
140
- end
141
- end
142
133
  end
143
134
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '4.33.0'
3
+ STRING = '4.34.0'
4
4
  end
5
5
  end
@@ -489,9 +489,9 @@ describe Beaker do
489
489
  end
490
490
 
491
491
  it 'skips validation on cisco hosts' do
492
- @platform = 'cisco_nexus-7-x86_64'
493
- expect( subject ).to receive( :check_and_install_packages_if_needed ).never
494
- subject.validate_host(hosts, options)
492
+ host = make_host('cisco-7', { stdout: stdout, platform: 'cisco_nexus-7-x86_64' })
493
+ expect( subject ).to receive( :check_and_install_packages_if_needed ).with(host, []).once
494
+ subject.validate_host(host, options)
495
495
  end
496
496
  end
497
497
 
@@ -17,12 +17,7 @@ module Beaker
17
17
  expect( logger.convert(valid_utf8) ).to be === valid_utf8
18
18
  end
19
19
  it 'strips out invalid utf-8 characters' do
20
- #this is 1.9 behavior only
21
- if RUBY_VERSION.to_f >= 1.9
22
- expect( logger.convert(invalid_utf8) ).to be === valid_utf8
23
- else
24
- pending "not supported in ruby 1.8 (using #{RUBY_VERSION})"
25
- end
20
+ expect( logger.convert(invalid_utf8) ).to be === valid_utf8
26
21
  end
27
22
  it 'supports frozen strings' do
28
23
  valid_utf8.freeze
@@ -145,7 +145,7 @@ module Beaker
145
145
  end
146
146
  end
147
147
 
148
- context 'round tripping from yaml', if: RUBY_VERSION =~ /^1\.9/ do
148
+ context 'round tripping from yaml' do
149
149
  before do
150
150
  @name = 'ubuntu-14.04-x86_64'
151
151
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.33.0
4
+ version: 4.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec