beaker_puppet_helpers 3.2.0 → 3.3.0

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: 8306e4b6e6e28049e3f096d179dc4330846463c447abcfe8ce764a528fee6e96
4
- data.tar.gz: ae6a8e1f75ac9e9793ff3f9c4dc3b8dd7f21f9fe83bf6a1078ed6af6bfd2400d
3
+ metadata.gz: d4b1b71e5893964ebe48c19fe00f8e656e022dd93d8cad2e7d2985a3f78ad66e
4
+ data.tar.gz: b989521ef3c8995e68e2b31e2bce8c118d960a488c66d697f909a0a9306d0b04
5
5
  SHA512:
6
- metadata.gz: 69aa2ec43f5e4008509b1e9dc497851887ffed12b58be8c861ee51b432a3edf0e2fd8aa1c78e68a6c6142e56e9fa59f8b4b98a300fd66526daea6ef2d3c99815
7
- data.tar.gz: 5242dfc352d988a3e1c9f400b9887e0e4e59982d4512c2ccd6b42826bc2fc53342fdf4d2356c11f8cdd3d258f5260df6e42b5ed6df12b6dcd576b478c193be32
6
+ metadata.gz: ce739711219f116c09a38c3f6d7ac16374b7402426625415a87556e1fe6420da5095283ae122f001e03274c501db55428c59c570fcdb521b7854ff90c3a776ea
7
+ data.tar.gz: 2e87a338eaa2c86afccb6495fb4b717512b085808b9c35a8c5a53042f6eb3d0a5d841219b76efcd10f54040b3010b0105569ab66c16cbd7d72b158aea24d4d85
@@ -24,7 +24,7 @@ jobs:
24
24
  shell: bash
25
25
  run: gem build --verbose *.gemspec
26
26
  - name: Upload gem to GitHub cache
27
- uses: actions/upload-artifact@v6
27
+ uses: actions/upload-artifact@v7
28
28
  with:
29
29
  name: gem-artifact
30
30
  path: '*.gem'
@@ -39,7 +39,7 @@ jobs:
39
39
  contents: write # clone repo and create release
40
40
  steps:
41
41
  - name: Download gem from GitHub cache
42
- uses: actions/download-artifact@v7
42
+ uses: actions/download-artifact@v8
43
43
  with:
44
44
  name: gem-artifact
45
45
  - name: Create Release
@@ -56,7 +56,7 @@ jobs:
56
56
  packages: write # publish to rubygems.pkg.github.com
57
57
  steps:
58
58
  - name: Download gem from GitHub cache
59
- uses: actions/download-artifact@v7
59
+ uses: actions/download-artifact@v8
60
60
  with:
61
61
  name: gem-artifact
62
62
  - name: Publish gem to GitHub packages
@@ -73,7 +73,7 @@ jobs:
73
73
  id-token: write # rubygems.org authentication
74
74
  steps:
75
75
  - name: Download gem from GitHub cache
76
- uses: actions/download-artifact@v7
76
+ uses: actions/download-artifact@v8
77
77
  with:
78
78
  name: gem-artifact
79
79
  - uses: rubygems/configure-rubygems-credentials@v1.0.0
@@ -92,7 +92,7 @@ jobs:
92
92
  - release-to-rubygems
93
93
  steps:
94
94
  - name: Download gem from GitHub cache
95
- uses: actions/download-artifact@v7
95
+ uses: actions/download-artifact@v8
96
96
  with:
97
97
  name: gem-artifact
98
98
  - name: Install Ruby
data/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.3.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.3.0) (2026-04-02)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.2.1...3.3.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Implement support for installing staging packages [\#102](https://github.com/voxpupuli/beaker_puppet_helpers/pull/102) ([bastelfreak](https://github.com/bastelfreak))
12
+
13
+ ## [3.2.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.1) (2026-01-21)
14
+
15
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.2.0...3.2.1)
16
+
17
+ **Fixed bugs:**
18
+
19
+ - apply\_manifest\_on no longer returns the output of the command [\#99](https://github.com/voxpupuli/beaker_puppet_helpers/issues/99)
20
+ - Restore behavior of apply\_manifest\_on [\#100](https://github.com/voxpupuli/beaker_puppet_helpers/pull/100) ([jaevans](https://github.com/jaevans))
21
+
5
22
  ## [3.2.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.0) (2026-01-06)
6
23
 
7
24
  [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.1.1...3.2.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'beaker_puppet_helpers'
5
- s.version = '3.2.0'
5
+ s.version = '3.3.0'
6
6
  s.authors = ['Vox Pupuli']
7
7
  s.email = ['voxpupuli@groups.io']
8
8
  s.homepage = 'https://github.com/voxpupuli/beaker_puppet_helpers'
@@ -15,6 +15,14 @@ Gem::Specification.new do |s|
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.require_paths = ['lib']
17
17
 
18
+ s.metadata = {
19
+ 'allowed_push_host' => 'https://rubygems.org',
20
+ 'source_code_uri' => 'https://github.com/voxpupuli/beaker_puppet_helpers',
21
+ 'changelog_uri' => 'https://github.com/voxpupuli/beaker_puppet_helpers/blob/main/CHANGELOG.md',
22
+ 'bug_tracker_uri' => 'https://github.com/voxpupuli/beaker_puppet_helpers/issues',
23
+ 'rubygems_mfa_required' => 'true',
24
+ }
25
+
18
26
  # Run time dependencies
19
27
  s.add_dependency 'beaker', '>= 5.8.1', '< 8'
20
28
  s.add_dependency 'nokogiri', '~> 1.18', '>= 1.18.10'
@@ -175,13 +175,12 @@ module BeakerPuppetHelpers
175
175
 
176
176
  file_path = host.tmpfile(%(apply_manifest_#{Time.now.strftime('%H%M%S%L')}), '.pp')
177
177
  begin
178
+ cleanup = false
178
179
  create_remote_file(host, file_path, "#{manifest}\n")
179
180
 
180
- on(host, Beaker::PuppetCommand.new('apply', file_path, puppet_apply_opts), **on_options, &block)
181
- success = true
182
- rescue StandardError
183
- success = false
184
- raise
181
+ result = on(host, Beaker::PuppetCommand.new('apply', file_path, puppet_apply_opts), **on_options, &block)
182
+ cleanup = true
183
+ result
185
184
  ensure
186
185
  # Respect BEAKER_destroy environment variable for file cleanup
187
186
  beaker_destroy = ENV.fetch('BEAKER_destroy', 'always').downcase
@@ -189,9 +188,9 @@ module BeakerPuppetHelpers
189
188
  when 'no', 'never'
190
189
  false
191
190
  when 'onpass'
192
- success
191
+ cleanup
193
192
  when 'onfail'
194
- !success
193
+ !cleanup
195
194
  else
196
195
  true
197
196
  end
@@ -172,5 +172,83 @@ module BeakerPuppetHelpers
172
172
  host.rm_rf(target)
173
173
  end
174
174
  end
175
+
176
+ # Build the openvox-agent package filename for a given host and version.
177
+ #
178
+ # The host's +packaging_platform+ attribute must follow the Beaker
179
+ # convention: "<variant>-<release>-<arch>", e.g.:
180
+ # "el-8-x86_64", "el-9-aarch64", "el-10-x86_64"
181
+ # "fedora-42-x86_64"
182
+ # "sles-15-x86_64", "sles-16-aarch64"
183
+ # "amazon-2-aarch64", "amazon-2023-x86_64"
184
+ # "ubuntu-22.04-amd64", "ubuntu-24.04-arm64"
185
+ # "debian-11-amd64", "debian-12-arm64"
186
+ #
187
+ # @param [Beaker::Host] host The target host
188
+ # @param [String] version The openvox-agent version, e.g. '8.25.0'
189
+ # @return [String] the package filename (not a full URL)
190
+ # @raise [ArgumentError] if the variant is unsupported
191
+ # @api private
192
+ def self.openvox_agent_staging_package_filename(host, version)
193
+ variant, release, arch = host['packaging_platform'].split('-', 3)
194
+
195
+ case variant
196
+ when 'el'
197
+ "openvox-agent-#{version}-1.el#{release}.#{arch}.rpm"
198
+ when 'fedora'
199
+ "openvox-agent-#{version}-1.fc#{release}.#{arch}.rpm"
200
+ when 'sles'
201
+ "openvox-agent-#{version}-1.sles#{release}.#{arch}.rpm"
202
+ when 'amazon'
203
+ "openvox-agent-#{version}-1.amazon#{release}.#{arch}.rpm"
204
+ when 'debian', 'ubuntu'
205
+ "openvox-agent_#{version}-1+#{variant}#{release}_#{arch}.deb"
206
+ else
207
+ raise ArgumentError,
208
+ "No openvox-agent package filename known for variant '#{variant}' " \
209
+ "(packaging_platform: '#{host['packaging_platform']}'). " \
210
+ 'Supported variants: el, fedora, sles, amazon, debian, ubuntu'
211
+ end
212
+ end
213
+
214
+ # Install the openvox-agent package on a host by downloading it directly
215
+ # from an artifact server.
216
+ #
217
+ # The correct package filename is derived from the host's +packaging_platform+
218
+ # attribute (see {.openvox_agent_staging_package_filename} for the expected format).
219
+ #
220
+ # @example
221
+ # InstallUtils.install_openvox_agent_from_url_on(
222
+ # host,
223
+ # 'https://artifacts.voxpupuli.org/openvox-agent',
224
+ # '8.25.0'
225
+ # )
226
+ #
227
+ # @param [Beaker::Host] host The host on which to install the package
228
+ # @param [String] base_url Base URL of the artifact server, without
229
+ # trailing slash, e.g.
230
+ # 'https://artifacts.voxpupuli.org/openvox-agent'
231
+ # @param [String] version The agent version to install, e.g. '8.25.0'
232
+ # @raise [ArgumentError] if the host's packaging_platform variant is unsupported
233
+ def self.install_openvox_agent_from_url_on(host, base_url, version)
234
+ filename = openvox_agent_staging_package_filename(host, version)
235
+ url = "#{base_url}/#{version}/#{filename}"
236
+ variant = host['packaging_platform'].split('-', 3).first
237
+
238
+ case variant
239
+ when 'el', 'fedora', 'sles', 'amazon'
240
+ # RPM: install_package accepts a URL directly (calls rpm/yum/zypper)
241
+ host.install_package(url)
242
+ when 'debian', 'ubuntu'
243
+ # Deb: must be downloaded to a local path first, then installed
244
+ wget_on(host, url) do |filename|
245
+ host.install_package(filename)
246
+ end
247
+ else
248
+ raise ArgumentError,
249
+ "No install strategy for variant '#{variant}' " \
250
+ "(packaging_platform: '#{host['packaging_platform']}')"
251
+ end
252
+ end
175
253
  end
176
254
  end
@@ -175,6 +175,25 @@ describe BeakerPuppetHelpers::DSL do
175
175
  dsl.apply_manifest_on(agent, 'class { "boo": }', show_diff: true)
176
176
  end
177
177
 
178
+ it 'returns the result of the on call on success' do
179
+ expected_result = instance_double(Beaker::Result)
180
+ expect(dsl).to receive(:create_remote_file).and_return(true)
181
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
182
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_return(expected_result)
183
+
184
+ result = dsl.apply_manifest_on(agent, 'class { "boo": }')
185
+ expect(result).to eq(expected_result)
186
+ end
187
+
188
+ it 'returns the result of the on call even when exceptions are raised' do
189
+ expect(dsl).to receive(:create_remote_file).and_return(true)
190
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
191
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'apply failed')
192
+ expect(agent).to receive(:rm_rf)
193
+
194
+ expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'apply failed')
195
+ end
196
+
178
197
  context 'with BEAKER_destroy environment variable' do
179
198
  after do
180
199
  ENV.delete('BEAKER_destroy')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker_puppet_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -135,7 +135,12 @@ files:
135
135
  homepage: https://github.com/voxpupuli/beaker_puppet_helpers
136
136
  licenses:
137
137
  - Apache-2.0
138
- metadata: {}
138
+ metadata:
139
+ allowed_push_host: https://rubygems.org
140
+ source_code_uri: https://github.com/voxpupuli/beaker_puppet_helpers
141
+ changelog_uri: https://github.com/voxpupuli/beaker_puppet_helpers/blob/main/CHANGELOG.md
142
+ bug_tracker_uri: https://github.com/voxpupuli/beaker_puppet_helpers/issues
143
+ rubygems_mfa_required: 'true'
139
144
  rdoc_options: []
140
145
  require_paths:
141
146
  - lib
@@ -150,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
155
  - !ruby/object:Gem::Version
151
156
  version: '0'
152
157
  requirements: []
153
- rubygems_version: 4.0.3
158
+ rubygems_version: 4.0.6
154
159
  specification_version: 4
155
160
  summary: Beaker's Puppet DSL Extension Helpers
156
161
  test_files: []