beaker_puppet_helpers 3.2.0 → 3.2.1

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: d75c6f419e157614121b5a9de767c2de8c3e2140dab6abf0930c681e9beadf4c
4
+ data.tar.gz: c4c8e080500c1857e20639e498f256f6219b7b654d35012fb8152dd5af1d7cb7
5
5
  SHA512:
6
- metadata.gz: 69aa2ec43f5e4008509b1e9dc497851887ffed12b58be8c861ee51b432a3edf0e2fd8aa1c78e68a6c6142e56e9fa59f8b4b98a300fd66526daea6ef2d3c99815
7
- data.tar.gz: 5242dfc352d988a3e1c9f400b9887e0e4e59982d4512c2ccd6b42826bc2fc53342fdf4d2356c11f8cdd3d258f5260df6e42b5ed6df12b6dcd576b478c193be32
6
+ metadata.gz: f76bd5da6ebf7799d713b6ce1f608445ad5bb4d048b67a327af81cfb7b6e5babcf1669372801804a6500c112467496e9d788d5e4c9cb9ed1ebb434979e16ca5e
7
+ data.tar.gz: 0d36eb4df0b6f9cadec39e5eabe04ac93ae574e4371ca9b8f486e60b5eab61b79e13906524262cd27036c0390db4fbfa75332b52a6bfb770b4383aa410d48448
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.2.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.1) (2026-01-21)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.2.0...3.2.1)
8
+
9
+ **Closed issues:**
10
+
11
+ - apply\_manifest\_on no longer returns the output of the command [\#99](https://github.com/voxpupuli/beaker_puppet_helpers/issues/99)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Restore behavior of apply\_manifest\_on [\#100](https://github.com/voxpupuli/beaker_puppet_helpers/pull/100) ([jaevans](https://github.com/jaevans))
16
+
5
17
  ## [3.2.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.0) (2026-01-06)
6
18
 
7
19
  [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.2.1'
6
6
  s.authors = ['Vox Pupuli']
7
7
  s.email = ['voxpupuli@groups.io']
8
8
  s.homepage = 'https://github.com/voxpupuli/beaker_puppet_helpers'
@@ -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
@@ -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.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli