beaker-puppet 4.4.3 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9d1aa526da4c8769497a59aabdbbe0ac613257a1821007382990de7c33c3894
4
- data.tar.gz: 8a39103726db46e5321e805fda7925197a2011c96f027dbd4cc9b936abcafc40
3
+ metadata.gz: 6596922b772810b4f5f4ae13f7937cfccc87d3933c94cf3a3c4f399b547c6d43
4
+ data.tar.gz: 5120dae2225cd78a6a396949276aaeddd701a2fd47be1230b16633286b26e9c4
5
5
  SHA512:
6
- metadata.gz: d71514b42d3f9aca125c68a7458a36c047a5a2a1214b5645acd0faba6274b3f30cc4e98de95526ce291318680a498491d977f8f150812a19a9f5f1c875b9d2db
7
- data.tar.gz: 61fd33d1feff22ddbce4580e3865dc187d381eb125c8698e6b455f5abbc3ab46fe785152a94c49f2d71a5e7ca822fa6874290f3b31138e87fdbabd708be39093
6
+ metadata.gz: 4b0022ed342729d0203383c87c3c7257743c66d24a925da42358a558c18745c47f0e118bc930ce69fc804aec90d8771999e49ca0513d59be784553b853bf521d
7
+ data.tar.gz: 6e7692488ef14c7706d27753db7ab06bc4290e0c661ecc2e03340f1aacb756f7e72d5548ff552415239170e76fcc62c34e6270240bfc2e998e6418affe3bfdbc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.4.4](https://github.com/puppetlabs/beaker-puppet/tree/4.4.4) (2026-11-25)
4
+
5
+ [Full Changelog](https://github.com/puppetlabs/beaker-puppet/compare/4.4.3...4.4.4)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - \(PA-9477\) Reset the apt timers' failed state after masking them [\#285](https://github.com/puppetlabs/beaker-puppet/pull/285) ([imaqsood](https://github.com/imaqsood))
10
+ - \(PA-8403\) Only install puppet-agent with dpkg on Ubuntu 24.04+ [\#284](https://github.com/puppetlabs/beaker-puppet/pull/284) ([imaqsood](https://github.com/imaqsood))
11
+ - \(P4DEVOPS-16835\) Stop the background apt upgrader and make apt wait for the dpkg lock [\#283](https://github.com/puppetlabs/beaker-puppet/pull/283) ([smahajan0228](https://github.com/smahajan0228))
12
+ - \(P4DEVOPS-16835\) Configure the gem mirror without downloading the rubygems index [\#282](https://github.com/puppetlabs/beaker-puppet/pull/282) ([smahajan0228](https://github.com/smahajan0228))
13
+
3
14
  ## [4.4.3](https://github.com/puppetlabs/beaker-puppet/tree/4.4.3) (2026-08-17)
4
15
 
5
16
  [Full Changelog](https://github.com/puppetlabs/beaker-puppet/compare/4.4.2...4.4.3)
@@ -1405,7 +1405,11 @@ module Beaker
1405
1405
  Array(hosts).each do |host|
1406
1406
  gem = gem_command(host)
1407
1407
  on host, "#{gem} source --clear-all"
1408
- on(host, "#{gem} source --add #{gem_source}")
1408
+ # `gem source --add` downloads and parses the complete rubygems index
1409
+ # just to check the source (about 330 MB of Ruby heap, 10-25 s), which
1410
+ # runs 32-bit Windows hosts out of memory (NoMemoryError). Register the
1411
+ # source through RubyGems directly: same ~/.gemrc, no index download.
1412
+ on(host, "#{ruby_command(host)} -e 'require \"rubygems\"; Gem.sources << \"#{gem_source}\"; Gem.configuration.write'")
1409
1413
  end
1410
1414
  end
1411
1415
  end
@@ -217,8 +217,10 @@ module Beaker
217
217
 
218
218
  install_targets.each do |host|
219
219
  artifact_url, repoconfig_url = host_urls(host, build_details, base_url)
220
- if host.platform.variant == 'ubuntu' && host.platform.version.to_f >= 24.04
221
- # install the specific artifact we built, not based on how its repos are configured
220
+ if project_name == 'puppet-agent' && host.platform.variant == 'ubuntu' && host.platform.version.to_f >= 24.04
221
+ # Ubuntu 24.04+ ships its own puppet-agent package, which uses different
222
+ # paths than ours. Install the specific artifact we built, not based on
223
+ # how its repos are configured, to ensure we get the correct package.
222
224
  tmp_file = host.tmpfile('puppet-agent')
223
225
  on(host, "curl -L --output #{tmp_file} #{artifact_url}")
224
226
  host.install_local_package(tmp_file)
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '4.4.3'
2
+ VERSION = '4.4.4'
3
3
  end
@@ -0,0 +1,51 @@
1
+ test_name 'Stop the background apt upgrader and make apt wait for the dpkg lock'
2
+
3
+ # Debian and Ubuntu images ship unattended-upgrades. systemd starts it from two
4
+ # timers, apt-daily.timer (06:00 and 18:00 UTC plus a random delay of up to
5
+ # 12 hours) and apt-daily-upgrade.timer (06:00 UTC plus up to 60 minutes). Both
6
+ # end up running unattended-upgrade, which holds the dpkg lock while it works.
7
+ # A test that installs or removes a package at that moment fails at once:
8
+ #
9
+ # E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process
10
+ # 1234 (unattended-upgr)
11
+ #
12
+ # Nothing a test does starts the upgrader; only the timers do. So:
13
+ #
14
+ # 1. Mask the timers (and the unattended-upgrades service) before any package
15
+ # management happens, so the upgrader cannot start again during the suite.
16
+ # This removes the cause. Masking a running timer leaves it failed ("Unit to
17
+ # trigger vanished"), which puts systemd in the "degraded" state. Debian's
18
+ # and Ubuntu's `service` then reload with `systemctl --no-block`, which exits
19
+ # 0 even when the unit is inactive, so bounce_service would never start a
20
+ # stopped puppetserver. Reset the failed state right after masking.
21
+ # 2. Keep a lock timeout for the run that may already be in progress when this
22
+ # step executes: masking does not release a lock that is already held, and we
23
+ # do not kill a running dpkg transaction. DPkg::Lock::Timeout makes every
24
+ # apt-get run on the host, including the ones puppet's apt provider starts,
25
+ # wait for the lock instead of failing. Versions of apt that do not know the
26
+ # option ignore it.
27
+ #
28
+ # On hosts whose hypervisor is 'none', 000-delete-puppet-when-none.rb runs before
29
+ # this step and uses the package manager, so it can still meet a running
30
+ # upgrader. The timeout covers that case.
31
+ APT_UPGRADER_UNITS = %w[apt-daily.timer apt-daily-upgrade.timer unattended-upgrades.service].freeze
32
+ DPKG_LOCK_TIMEOUT_FILE = '/etc/apt/apt.conf.d/99-beaker-dpkg-lock-timeout'.freeze
33
+ DPKG_LOCK_TIMEOUT = 300 # seconds
34
+
35
+ apt_hosts = hosts.select { |host| host.platform =~ /^(debian|ubuntu)-/ }
36
+ skip_test 'No Debian or Ubuntu hosts' if apt_hosts.empty?
37
+
38
+ apt_hosts.each do |host|
39
+ # /run/systemd/system exists only when systemd is the running init; without it
40
+ # there are no timers to mask (for example in a plain container).
41
+ systemd_running = on(host, 'test -d /run/systemd/system', accept_all_exit_codes: true).exit_code.zero?
42
+ if systemd_running
43
+ on(host, "systemctl mask --now #{APT_UPGRADER_UNITS.join(' ')}")
44
+ # Units this image doesn't have (e.g. no unattended-upgrades) can't be reset.
45
+ on(host, "systemctl reset-failed #{APT_UPGRADER_UNITS.join(' ')}", accept_all_exit_codes: true)
46
+ end
47
+
48
+ create_remote_file(host, DPKG_LOCK_TIMEOUT_FILE, "DPkg::Lock::Timeout \"#{DPKG_LOCK_TIMEOUT}\";\n")
49
+ # create_remote_file copies the file as 0600; apt run by other users must be able to read it too.
50
+ on(host, "chmod 0644 #{DPKG_LOCK_TIMEOUT_FILE}")
51
+ end
@@ -21,13 +21,5 @@ step 'Verify host times' do
21
21
  end
22
22
 
23
23
  step 'Configure gem mirror' do
24
- # Skip if RELEASE_STREAM is 'puppet9' and platform is aix or solaris
25
- # Issue with Rubygems's SafeMarshal see: PA-8312
26
- release_stream = ENV.fetch('RELEASE_STREAM')
27
- skip_platforms = /aix|solaris/i
28
- if release_stream == 'puppet9' && hosts.any? { |host| host['platform'] =~ skip_platforms }
29
- logger.info 'Skipping configure_gem_mirror for puppet9 on aix/solaris, issue with rubygems 4.0'
30
- else
31
- configure_gem_mirror(hosts)
32
- end
24
+ configure_gem_mirror(hosts)
33
25
  end
@@ -1200,4 +1200,61 @@ describe ClassMixedWithDSLInstallUtils do
1200
1200
  expect { subject.remove_puppet_on(debian6) }.to raise_error(RuntimeError, /unsupported platform/)
1201
1201
  end
1202
1202
  end
1203
+
1204
+ describe '#configure_gem_mirror' do
1205
+ let(:mirror) { 'https://artifactory.example.com/artifactory/api/gems/rubygems/' }
1206
+ let(:linux_host) do
1207
+ make_host('linuxbox', platform: 'ubuntu-22.04-x86_64', privatebindir: '/opt/puppetlabs/puppet/bin')
1208
+ end
1209
+ let(:windows_host) do
1210
+ make_host('winbox', platform: 'windows-2019-64',
1211
+ privatebindir: '/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin')
1212
+ end
1213
+
1214
+ around do |example|
1215
+ old = ENV.fetch('GEM_SOURCE', nil)
1216
+ ENV['GEM_SOURCE'] = mirror
1217
+ example.run
1218
+ ensure
1219
+ ENV['GEM_SOURCE'] = old
1220
+ end
1221
+
1222
+ it 'does nothing when GEM_SOURCE is unset' do
1223
+ ENV.delete('GEM_SOURCE')
1224
+ expect(subject).not_to receive(:on)
1225
+ subject.configure_gem_mirror(linux_host)
1226
+ end
1227
+
1228
+ it 'does nothing when GEM_SOURCE is rubygems.org' do
1229
+ ENV['GEM_SOURCE'] = 'https://rubygems.org'
1230
+ expect(subject).not_to receive(:on)
1231
+ subject.configure_gem_mirror(linux_host)
1232
+ end
1233
+
1234
+ it 'registers the mirror through RubyGems without `gem source --add`' do
1235
+ # `gem source --add` downloads and parses the whole rubygems index
1236
+ # (about 330 MB of Ruby heap), which runs 32-bit Windows hosts out of memory.
1237
+ expect(subject).to receive(:on).with(linux_host, /gem source --clear-all/).ordered
1238
+ expect(subject).to receive(:on).with(
1239
+ linux_host,
1240
+ %r{\Aenv PATH="/opt/puppetlabs/puppet/bin:\$\{PATH\}" ruby -e 'require "rubygems"; Gem\.sources << "#{Regexp.escape(mirror)}"; Gem\.configuration\.write'\z},
1241
+ ).ordered
1242
+ expect(subject).not_to receive(:on).with(anything, /gem source --add/)
1243
+ subject.configure_gem_mirror(linux_host)
1244
+ end
1245
+
1246
+ it 'uses `cmd /c` only for the gem command on windows' do
1247
+ expect(subject).to receive(:on).with(windows_host, %r{cmd /c gem source --clear-all}).ordered
1248
+ expect(subject).to receive(:on).with(
1249
+ windows_host,
1250
+ %r{\Aenv PATH="/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin:\$\{PATH\}" ruby -e 'require "rubygems"; Gem\.sources << "#{Regexp.escape(mirror)}"; Gem\.configuration\.write'\z},
1251
+ ).ordered
1252
+ subject.configure_gem_mirror(windows_host)
1253
+ end
1254
+
1255
+ it 'configures every host' do
1256
+ expect(subject).to receive(:on).exactly(4).times
1257
+ subject.configure_gem_mirror([linux_host, windows_host])
1258
+ end
1259
+ end
1203
1260
  end
@@ -363,9 +363,9 @@ describe ClassMixedWithDSLInstallUtils do
363
363
  end.to raise_error(Beaker::DSL::Outcomes::FailTest, /project_name.*#{sha_yaml_url}/)
364
364
  end
365
365
 
366
- it 'installs the artifact on newer Ubuntu hosts' do
366
+ it 'installs the puppet-agent artifact on newer Ubuntu hosts' do
367
367
  artifact_url = 'https://builds.example.com/puppet-agent.deb'
368
- project_name = 'fake_project_66'
368
+ project_name = 'puppet-agent'
369
369
  allow(subject).to receive(:fetch_build_details)
370
370
  allow(subject).to receive(:configure_type_defaults_on)
371
371
  allow(subject).to receive(:host_urls) { [artifact_url, ''] }
@@ -380,6 +380,22 @@ describe ClassMixedWithDSLInstallUtils do
380
380
  subject.install_from_build_data_url(project_name, 'sha_yaml_url')
381
381
  end
382
382
 
383
+ it 'installs other projects through their repo on newer Ubuntu hosts' do
384
+ repoconfig_url = 'https://builds.example.com/puppetserver.list'
385
+ allow(subject).to receive(:fetch_build_details)
386
+ allow(subject).to receive(:configure_type_defaults_on)
387
+ allow(subject).to receive(:host_urls) { ['', repoconfig_url] }
388
+
389
+ hosts = [make_host('host.example.com', platform: Beaker::Platform.new('ubuntu-24.04-x86_64'))]
390
+ allow(subject).to receive(:hosts).and_return(hosts)
391
+ hosts.each do |host|
392
+ expect(host).not_to receive(:install_local_package)
393
+ expect(subject).to receive(:install_repo_configs_on).with(host, repoconfig_url)
394
+ expect(host).to receive(:install_package).with('puppetserver')
395
+ end
396
+ subject.install_from_build_data_url('puppetserver', 'sha_yaml_url')
397
+ end
398
+
383
399
  it 'runs host.install_package instead of #install_artifact_on if theres a repo_config' do
384
400
  repoconfig_url = 'pants/man/shoot/to/the/stars'
385
401
  project_name = 'fake_project_66'
data/tasks/ci.rake CHANGED
@@ -369,6 +369,7 @@ def pre_suites(type)
369
369
  "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
370
370
  "#{beaker_root}/setup/common/003_solaris_cert_fix.rb",
371
371
  "#{beaker_root}/setup/common/005_redhat_subscription_fix.rb",
372
+ "#{beaker_root}/setup/common/006_apt_lock_timeout.rb",
372
373
  "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
373
374
  "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
374
375
  "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
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: 4.4.3
4
+ version: 4.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-17 00:00:00.000000000 Z
11
+ date: 2026-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs
@@ -205,6 +205,7 @@ files:
205
205
  - setup/common/000-delete-puppet-when-none.rb
206
206
  - setup/common/003_solaris_cert_fix.rb
207
207
  - setup/common/005_redhat_subscription_fix.rb
208
+ - setup/common/006_apt_lock_timeout.rb
208
209
  - setup/common/011_Install_Puppet_Server.rb
209
210
  - setup/common/012_Finalize_Installs.rb
210
211
  - setup/common/025_StopFirewall.rb