beaker_puppet_helpers 3.1.1 → 3.2.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 +4 -4
- data/.github/workflows/release.yml +6 -6
- data/.github/workflows/test.yml +3 -3
- data/.rubocop.yml +0 -3
- data/.rubocop_todo.yml +3 -7
- data/CHANGELOG.md +9 -0
- data/README.md +7 -0
- data/beaker_puppet_helpers.gemspec +2 -2
- data/lib/beaker_puppet_helpers/dsl.rb +18 -1
- data/spec/beaker_puppet_helpers/dsl_spec.rb +75 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8306e4b6e6e28049e3f096d179dc4330846463c447abcfe8ce764a528fee6e96
|
|
4
|
+
data.tar.gz: ae6a8e1f75ac9e9793ff3f9c4dc3b8dd7f21f9fe83bf6a1078ed6af6bfd2400d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69aa2ec43f5e4008509b1e9dc497851887ffed12b58be8c861ee51b432a3edf0e2fd8aa1c78e68a6c6142e56e9fa59f8b4b98a300fd66526daea6ef2d3c99815
|
|
7
|
+
data.tar.gz: 5242dfc352d988a3e1c9f400b9887e0e4e59982d4512c2ccd6b42826bc2fc53342fdf4d2356c11f8cdd3d258f5260df6e42b5ed6df12b6dcd576b478c193be32
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
name: Build the gem
|
|
16
16
|
runs-on: ubuntu-24.04
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
19
|
- name: Install Ruby
|
|
20
20
|
uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
@@ -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@
|
|
27
|
+
uses: actions/upload-artifact@v6
|
|
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@
|
|
42
|
+
uses: actions/download-artifact@v7
|
|
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@
|
|
59
|
+
uses: actions/download-artifact@v7
|
|
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@
|
|
76
|
+
uses: actions/download-artifact@v7
|
|
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@
|
|
95
|
+
uses: actions/download-artifact@v7
|
|
96
96
|
with:
|
|
97
97
|
name: gem-artifact
|
|
98
98
|
- name: Install Ruby
|
data/.github/workflows/test.yml
CHANGED
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
outputs:
|
|
20
20
|
ruby: ${{ steps.ruby.outputs.versions }}
|
|
21
21
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@v6
|
|
23
23
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
24
24
|
uses: ruby/setup-ruby@v1
|
|
25
25
|
with:
|
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
- name: Rubocop
|
|
29
29
|
run: bundle exec rake rubocop
|
|
30
30
|
- id: ruby
|
|
31
|
-
uses: voxpupuli/ruby-version@
|
|
31
|
+
uses: voxpupuli/ruby-version@v2
|
|
32
32
|
|
|
33
33
|
build:
|
|
34
34
|
runs-on: ubuntu-latest
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
|
40
40
|
name: Ruby ${{ matrix.ruby }}
|
|
41
41
|
steps:
|
|
42
|
-
- uses: actions/checkout@
|
|
42
|
+
- uses: actions/checkout@v6
|
|
43
43
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
44
44
|
uses: ruby/setup-ruby@v1
|
|
45
45
|
with:
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
|
|
3
|
-
# using RuboCop version 1.
|
|
3
|
+
# using RuboCop version 1.81.7.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count:
|
|
9
|
+
# Offense count: 27
|
|
10
10
|
# Configuration parameters: CountAsOne.
|
|
11
11
|
RSpec/ExampleLength:
|
|
12
12
|
Max: 9
|
|
13
13
|
|
|
14
|
-
# Offense count:
|
|
14
|
+
# Offense count: 125
|
|
15
15
|
# Configuration parameters: .
|
|
16
16
|
# SupportedStyles: have_received, receive
|
|
17
17
|
RSpec/MessageSpies:
|
|
18
18
|
EnforcedStyle: receive
|
|
19
19
|
|
|
20
|
-
# Offense count: 26
|
|
21
|
-
RSpec/MultipleExpectations:
|
|
22
|
-
Max: 7
|
|
23
|
-
|
|
24
20
|
# Offense count: 4
|
|
25
21
|
# Configuration parameters: AllowedGroups.
|
|
26
22
|
RSpec/NestedGroups:
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [3.2.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.0) (2026-01-06)
|
|
6
|
+
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.1.1...3.2.0)
|
|
8
|
+
|
|
9
|
+
**Implemented enhancements:**
|
|
10
|
+
|
|
11
|
+
- Add Ruby 4.0 support [\#96](https://github.com/voxpupuli/beaker_puppet_helpers/pull/96) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
12
|
+
- Respect `BEAKER_destroy` for manifest cleanup [\#93](https://github.com/voxpupuli/beaker_puppet_helpers/pull/93) ([bwitt](https://github.com/bwitt))
|
|
13
|
+
|
|
5
14
|
## [3.1.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.1.1) (2025-09-22)
|
|
6
15
|
|
|
7
16
|
[Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.1.0...3.1.1)
|
data/README.md
CHANGED
|
@@ -55,6 +55,12 @@ environment, you can use `BEAKER_HOSTS`, passing a file path to a beaker hosts
|
|
|
55
55
|
file or a beaker-hostgenerator value. You can also specify the tests that get
|
|
56
56
|
executed with the `TESTS` environment variable.
|
|
57
57
|
|
|
58
|
+
Use the `BEAKER_destroy` environment variable to control whether to cleanup
|
|
59
|
+
temporary manifest files created during `apply_manifest_on` calls. Set it to
|
|
60
|
+
`never` to preserve files for debugging, `onpass` to keep files only when tests
|
|
61
|
+
fail, or `onfail` to keep files only when tests pass. The default (`always`)
|
|
62
|
+
deletes files after every run.
|
|
63
|
+
|
|
58
64
|
## License
|
|
59
65
|
|
|
60
66
|
This gem is licensed under the Apache-2 license.
|
|
@@ -62,6 +68,7 @@ This gem is licensed under the Apache-2 license.
|
|
|
62
68
|
## Release information
|
|
63
69
|
|
|
64
70
|
To make a new release, please do:
|
|
71
|
+
|
|
65
72
|
* update the version in `beaker_puppet_helpers.gemspec`
|
|
66
73
|
* Install gems with `bundle install --with release --path .vendor`
|
|
67
74
|
* generate the changelog with `bundle exec rake changelog`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'beaker_puppet_helpers'
|
|
5
|
-
s.version = '3.
|
|
5
|
+
s.version = '3.2.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'
|
|
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.add_dependency 'open-uri', '< 0.6'
|
|
22
22
|
s.add_dependency 'puppet-modulebuilder', '>= 0.3', '< 3'
|
|
23
23
|
|
|
24
|
-
s.add_development_dependency 'voxpupuli-rubocop', '~>
|
|
24
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 5.1.0'
|
|
25
25
|
end
|
|
@@ -178,8 +178,25 @@ module BeakerPuppetHelpers
|
|
|
178
178
|
create_remote_file(host, file_path, "#{manifest}\n")
|
|
179
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
185
|
ensure
|
|
182
|
-
|
|
186
|
+
# Respect BEAKER_destroy environment variable for file cleanup
|
|
187
|
+
beaker_destroy = ENV.fetch('BEAKER_destroy', 'always').downcase
|
|
188
|
+
should_delete = case beaker_destroy
|
|
189
|
+
when 'no', 'never'
|
|
190
|
+
false
|
|
191
|
+
when 'onpass'
|
|
192
|
+
success
|
|
193
|
+
when 'onfail'
|
|
194
|
+
!success
|
|
195
|
+
else
|
|
196
|
+
true
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
host.rm_rf(file_path) if should_delete
|
|
183
200
|
end
|
|
184
201
|
end
|
|
185
202
|
end
|
|
@@ -174,6 +174,81 @@ describe BeakerPuppetHelpers::DSL do
|
|
|
174
174
|
|
|
175
175
|
dsl.apply_manifest_on(agent, 'class { "boo": }', show_diff: true)
|
|
176
176
|
end
|
|
177
|
+
|
|
178
|
+
context 'with BEAKER_destroy environment variable' do
|
|
179
|
+
after do
|
|
180
|
+
ENV.delete('BEAKER_destroy')
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it 'always deletes manifest file by default (always)' do
|
|
184
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
185
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
186
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
|
|
187
|
+
expect(agent).to receive(:rm_rf)
|
|
188
|
+
|
|
189
|
+
dsl.apply_manifest_on(agent, 'class { "boo": }')
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
it 'never deletes manifest file when BEAKER_destroy=never' do
|
|
193
|
+
ENV['BEAKER_destroy'] = 'never'
|
|
194
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
195
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
196
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
|
|
197
|
+
expect(agent).not_to receive(:rm_rf)
|
|
198
|
+
|
|
199
|
+
dsl.apply_manifest_on(agent, 'class { "boo": }')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it 'always deletes manifest file when BEAKER_destroy=always' do
|
|
203
|
+
ENV['BEAKER_destroy'] = 'always'
|
|
204
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
205
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
206
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
|
|
207
|
+
expect(agent).to receive(:rm_rf)
|
|
208
|
+
|
|
209
|
+
dsl.apply_manifest_on(agent, 'class { "boo": }')
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
it 'deletes manifest file on success when BEAKER_destroy=onpass' do
|
|
213
|
+
ENV['BEAKER_destroy'] = 'onpass'
|
|
214
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
215
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
216
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
|
|
217
|
+
expect(agent).to receive(:rm_rf)
|
|
218
|
+
|
|
219
|
+
dsl.apply_manifest_on(agent, 'class { "boo": }')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it 'preserves manifest file on failure when BEAKER_destroy=onpass' do
|
|
223
|
+
ENV['BEAKER_destroy'] = 'onpass'
|
|
224
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
225
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
226
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'test failure')
|
|
227
|
+
expect(agent).not_to receive(:rm_rf)
|
|
228
|
+
|
|
229
|
+
expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'test failure')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
it 'deletes manifest file on failure when BEAKER_destroy=onfail' do
|
|
233
|
+
ENV['BEAKER_destroy'] = 'onfail'
|
|
234
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
235
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
236
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'test failure')
|
|
237
|
+
expect(agent).to receive(:rm_rf)
|
|
238
|
+
|
|
239
|
+
expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'test failure')
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it 'preserves manifest file on success when BEAKER_destroy=onfail' do
|
|
243
|
+
ENV['BEAKER_destroy'] = 'onfail'
|
|
244
|
+
expect(dsl).to receive(:create_remote_file).and_return(true)
|
|
245
|
+
expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
|
|
246
|
+
expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
|
|
247
|
+
expect(agent).not_to receive(:rm_rf)
|
|
248
|
+
|
|
249
|
+
dsl.apply_manifest_on(agent, 'class { "boo": }')
|
|
250
|
+
end
|
|
251
|
+
end
|
|
177
252
|
end
|
|
178
253
|
|
|
179
254
|
describe '#apply_manifest' do
|
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.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vox Pupuli
|
|
@@ -89,14 +89,14 @@ dependencies:
|
|
|
89
89
|
requirements:
|
|
90
90
|
- - "~>"
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version:
|
|
92
|
+
version: 5.1.0
|
|
93
93
|
type: :development
|
|
94
94
|
prerelease: false
|
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements:
|
|
97
97
|
- - "~>"
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
|
-
version:
|
|
99
|
+
version: 5.1.0
|
|
100
100
|
description: For use for the Beaker acceptance testing tool
|
|
101
101
|
email:
|
|
102
102
|
- voxpupuli@groups.io
|
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
151
|
version: '0'
|
|
152
152
|
requirements: []
|
|
153
|
-
rubygems_version:
|
|
153
|
+
rubygems_version: 4.0.3
|
|
154
154
|
specification_version: 4
|
|
155
155
|
summary: Beaker's Puppet DSL Extension Helpers
|
|
156
156
|
test_files: []
|