beaker_puppet_helpers 1.2.1 → 1.4.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: ecec587a641c9175b474f3f5862cce202097db3a13c6085e96e38b5795dbb42a
4
- data.tar.gz: 0cda17558b4ccfd995d8747158460a7e9793739b1601bbc14a3265057445a3a5
3
+ metadata.gz: b001b9c348f8e6b21b1fb495af1163b6da37668267f3335cd43ef5227d47a7e1
4
+ data.tar.gz: 04ee8755335878f1e0f36905a403c38a971223e8ab3225efb2ae22d441b9fa97
5
5
  SHA512:
6
- metadata.gz: 69df43481f5173128fffc205b27a9a7b91b73bc707986092b7626065e3072c1601b89addb7e8223417ecefbbc5525397a28d44dda4a60bf60c833c29a75e95cc
7
- data.tar.gz: 76b71365c7c9821195f7e6c94b49924dc0a84612173fad6d2f057c86b952c1a6483e5bfe1d804aa6464408407fe47f87e7cc25041b2cdc0f88619772ba5495a6
6
+ metadata.gz: 589ffd7e3989e29e1b593d7ece8b01e38763830ce14675fbcdc3aa54301a93eafe552150127c3ea0b0967334b3fbdc1bb8e3c71472292d2d7acf9ddaa9df7eac
7
+ data.tar.gz: f213200034c144418780365b1dbee9f4e3cc6b5179fda3efe28ca00f298ef7a1cc65194698e85da6226a42cdf007beefdc8c7bf02293af23271854fde253edfa
@@ -11,10 +11,10 @@ jobs:
11
11
  if: github.repository_owner == 'voxpupuli'
12
12
  steps:
13
13
  - uses: actions/checkout@v4
14
- - name: Install Ruby 3.0
14
+ - name: Install Ruby 3.3
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: '3.0'
17
+ ruby-version: '3.3'
18
18
  bundler: 'none'
19
19
  - name: Build gem
20
20
  run: gem build --strict --verbose *.gemspec
@@ -19,7 +19,7 @@ jobs:
19
19
  - name: Install Ruby ${{ matrix.ruby }}
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
22
- ruby-version: "3.0"
22
+ ruby-version: "3.3"
23
23
  bundler-cache: true
24
24
  - name: Rubocop
25
25
  run: bundle exec rake rubocop
@@ -30,6 +30,7 @@ jobs:
30
30
  fail-fast: false
31
31
  matrix:
32
32
  ruby:
33
+ - "3.3"
33
34
  - "3.2"
34
35
  - "3.1"
35
36
  - "3.0"
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ junit/
11
11
  tmp/
12
12
  vendor/
13
13
  .vendor/
14
+ .bundle/
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-05-05 18:42:04 UTC using RuboCop version 1.50.2.
3
+ # on 2024-05-28 10:04:32 UTC using RuboCop version 1.63.5.
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
@@ -11,13 +11,13 @@
11
11
  RSpec/ExampleLength:
12
12
  Max: 9
13
13
 
14
- # Offense count: 72
14
+ # Offense count: 77
15
15
  # Configuration parameters: .
16
16
  # SupportedStyles: have_received, receive
17
17
  RSpec/MessageSpies:
18
18
  EnforcedStyle: receive
19
19
 
20
- # Offense count: 24
20
+ # Offense count: 26
21
21
  RSpec/MultipleExpectations:
22
22
  Max: 7
23
23
 
@@ -25,3 +25,9 @@ RSpec/MultipleExpectations:
25
25
  # Configuration parameters: AllowedGroups.
26
26
  RSpec/NestedGroups:
27
27
  Max: 4
28
+
29
+ # Offense count: 2
30
+ # This cop supports unsafe autocorrection (--autocorrect-all).
31
+ RSpec/ReceiveMessages:
32
+ Exclude:
33
+ - 'spec/beaker_puppet_helpers/dsl_spec.rb'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.4.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/1.4.0) (2024-05-28)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/1.3.0...1.4.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - beaker: Allow 6.x [\#47](https://github.com/voxpupuli/beaker_puppet_helpers/pull/47) ([bastelfreak](https://github.com/bastelfreak))
12
+ - Use tmpfile extension [\#3](https://github.com/voxpupuli/beaker_puppet_helpers/pull/3) ([ekohl](https://github.com/ekohl))
13
+
14
+ **Merged pull requests:**
15
+
16
+ - .gitignore: add .bundle [\#46](https://github.com/voxpupuli/beaker_puppet_helpers/pull/46) ([bastelfreak](https://github.com/bastelfreak))
17
+ - voxpupuli-rubocop: Require 2.7.0 [\#45](https://github.com/voxpupuli/beaker_puppet_helpers/pull/45) ([bastelfreak](https://github.com/bastelfreak))
18
+
19
+ ## [1.3.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/1.3.0) (2024-05-02)
20
+
21
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/1.2.1...1.3.0)
22
+
23
+ **Implemented enhancements:**
24
+
25
+ - Add Ruby 3.3 to CI [\#44](https://github.com/voxpupuli/beaker_puppet_helpers/pull/44) ([traylenator](https://github.com/traylenator))
26
+ - New beaker helper `bolt_supported?` to show bolt availability [\#42](https://github.com/voxpupuli/beaker_puppet_helpers/pull/42) ([traylenator](https://github.com/traylenator))
27
+
5
28
  ## [1.2.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/1.2.1) (2024-01-08)
6
29
 
7
30
  [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/1.2.0...1.2.1)
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ group :development do
13
13
  end
14
14
 
15
15
  group :rubocop do
16
- gem 'voxpupuli-rubocop', '~> 1.2'
16
+ gem 'voxpupuli-rubocop', '~> 2.7.0'
17
17
  end
18
18
 
19
19
  group :test do
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'beaker_puppet_helpers'
5
- s.version = '1.2.1'
5
+ s.version = '1.4.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'
@@ -16,6 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ['lib']
17
17
 
18
18
  # Run time dependencies
19
- s.add_runtime_dependency 'beaker', '>= 4', '< 6'
19
+ s.add_runtime_dependency 'beaker', '>= 5.8.1', '< 7'
20
20
  s.add_runtime_dependency 'puppet-modulebuilder', '>= 0.3', '< 2'
21
21
  end
@@ -173,7 +173,7 @@ module BeakerPuppetHelpers
173
173
 
174
174
  puppet_apply_opts = host[:default_apply_opts].merge(puppet_apply_opts) if host[:default_apply_opts].respond_to? :merge
175
175
 
176
- file_path = host.tmpfile(%(apply_manifest_#{Time.now.strftime('%H%M%S%L')}.pp))
176
+ file_path = host.tmpfile(%(apply_manifest_#{Time.now.strftime('%H%M%S%L')}), '.pp')
177
177
  begin
178
178
  create_remote_file(host, file_path, "#{manifest}\n")
179
179
 
@@ -224,5 +224,30 @@ module BeakerPuppetHelpers
224
224
  def fact(name, opts = {})
225
225
  fact_on(default, name, opts)
226
226
  end
227
+
228
+ # Show if bolt package is available
229
+ #
230
+ # @param [Beaker::Host] host
231
+ # @return True if package is available.
232
+ #
233
+ def bolt_supported?(host = default)
234
+ #
235
+ # Supported platforms
236
+ # https://github.com/puppetlabs/bolt/blob/main/documentation/bolt_installing.md
237
+ # https://github.com/puppetlabs/bolt-vanagon/tree/main/configs/platforms
238
+
239
+ case host['packaging_platform'].split('-', 3)[0, 1]
240
+ when %w[el 7], %w[el 8], %w[el 9],
241
+ %w[debian 10], %w[debian 11],
242
+ ['ubuntu', '20.04'], ['ubuntu', '22.04'],
243
+ %w[osx 11], %w[osx 12],
244
+ %w[sles 12], %w[sles 15],
245
+ %w[fedora 36],
246
+ %w[windows 2012r2]
247
+ true
248
+ else
249
+ false
250
+ end
251
+ end
227
252
  end
228
253
  end
@@ -80,14 +80,14 @@ module BeakerPuppetHelpers
80
80
  case host['packaging_platform'].split('-', 3).first
81
81
  when 'debian'
82
82
  # 12 started to ship puppet-agent with puppet as a legacy package
83
- prefer_aio || host['packaging_platform'].split('-', 3)[1].to_i >= 12 ? 'puppet-agent' : 'puppet'
83
+ (prefer_aio || host['packaging_platform'].split('-', 3)[1].to_i >= 12) ? 'puppet-agent' : 'puppet'
84
84
  when /el|fedora|sles|cisco_/
85
85
  prefer_aio ? 'puppet-agent' : 'puppet'
86
86
  when /freebsd/
87
87
  'sysutils/puppet8'
88
88
  when 'ubuntu'
89
89
  # 23.04 started to ship puppet-agent with puppet as a legacy package
90
- prefer_aio || host['packaging_platform'].split('-', 3)[1].to_i >= 2304 ? 'puppet-agent' : 'puppet'
90
+ (prefer_aio || host['packaging_platform'].split('-', 3)[1].to_i >= 2304) ? 'puppet-agent' : 'puppet'
91
91
  else
92
92
  'puppet'
93
93
  end
@@ -99,8 +99,7 @@ module BeakerPuppetHelpers
99
99
  def self.wget_on(host, url)
100
100
  extension = File.extname(url)
101
101
  name = File.basename(url, extension)
102
- # Can't use host.tmpfile since we need to set an extension
103
- target = host.exec(Beaker::Command.new("mktemp -t '#{name}-XXXXXX#{extension}'")).stdout.strip
102
+ target = host.tmpfile(name, extension)
104
103
  begin
105
104
  host.exec(Beaker::Command.new("wget -O '#{target}' '#{url}'"))
106
105
  yield target
@@ -44,7 +44,7 @@ module BeakerPuppetHelpers
44
44
  source_path = builder.build
45
45
  begin
46
46
  block_on hosts do |host|
47
- target_file = host.tmpfile('puppet_module')
47
+ target_file = host.tmpfile('puppet_module', '.tar.gz')
48
48
  begin
49
49
  host.do_scp_to(source_path, target_file, {})
50
50
  install_puppet_module_via_pmt_on(host, target_file)
@@ -97,7 +97,7 @@ describe BeakerPuppetHelpers::ModuleUtils do
97
97
  expect(Puppet::Modulebuilder::Builder).to receive(:new).with('/path/to/module').and_return(builder)
98
98
  expect(builder).to receive(:build).and_return('/path/to/tarball')
99
99
 
100
- expect(host).to receive(:tmpfile).with('puppet_module').and_return('temp')
100
+ expect(host).to receive(:tmpfile).with('puppet_module', '.tar.gz').and_return('temp')
101
101
  expect(host).to receive(:do_scp_to).with('/path/to/tarball', 'temp', {})
102
102
  expect(dsl).to receive(:install_puppet_module_via_pmt_on).with(host, 'temp')
103
103
  expect(host).to receive(:rm_rf).with('temp')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker_puppet_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: beaker
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: 5.8.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4'
29
+ version: 5.8.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: puppet-modulebuilder
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.2.33
106
+ rubygems_version: 3.5.9
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Beaker's Puppet DSL Extension Helpers