Skip to content

Commit f26fd6f

Browse files
authored
Merge branch 'main' into halln-fix-sensitive
2 parents 1b322c4 + 94d8ce8 commit f26fd6f

File tree

10 files changed

+98
-59
lines changed

10 files changed

+98
-59
lines changed

.fixtures.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ fixtures:
44
provision: 'https://github.com/puppetlabs/provision.git'
55
puppet_agent:
66
repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
7-
ref: v4.21.0
87
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
98
symlinks:
109
concat: '#{source_dir}'

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ on:
99
jobs:
1010
Spec:
1111
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
12+
with:
13+
flags: "--nightly"
1214
secrets: "inherit"
1315

1416
Acceptance:
1517
needs: Spec
1618
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
17-
secrets: "inherit"
1819
with:
19-
runs_on: "ubuntu-24.04"
20+
flags: "--nightly"
21+
secrets: "inherit"

.github/workflows/nightly.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ jobs:
1414
needs: Spec
1515
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
1616
secrets: "inherit"
17-
with:
18-
runs_on: "ubuntu-24.04"

.puppet-lint.rc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1+
--fail-on-warnings
12
--relative
3+
--no-80chars-check
4+
--no-140chars-check
5+
--no-class_inherits_from_params_class-check
6+
--no-autoloader_layout-check
7+
--no-documentation-check
8+
--no-single_quote_string_with_variables-check
9+
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require:
55
AllCops:
66
NewCops: enable
77
DisplayCopNames: true
8-
TargetRubyVersion: '2.6'
8+
TargetRubyVersion: 3.1
99
Include:
1010
- "**/*.rb"
1111
Exclude:

Gemfile

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,101 @@
1-
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
1+
# frozen_string_literal: true
22

3-
def location_for(place_or_version, fake_version = nil)
4-
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5-
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
3+
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com'
4+
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org'
5+
gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN']
6+
'https://rubygems-puppetcore.puppet.com'
7+
else
8+
ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default
9+
end
10+
source gemsource_default
11+
12+
def location_for(place_or_constraint, fake_constraint = nil, opts = {})
13+
git_url_regex = /\A(?<url>(?:https?|git)[:@][^#]*)(?:#(?<branch>.*))?/
14+
file_url_regex = %r{\Afile://(?<path>.*)}
15+
16+
if place_or_constraint && (git_url = place_or_constraint.match(git_url_regex))
17+
# Git source → ignore :source, keep fake_constraint
18+
[fake_constraint, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
19+
20+
elsif place_or_constraint && (file_url = place_or_constraint.match(file_url_regex))
21+
# File source → ignore :source, keep fake_constraint or default >= 0
22+
[fake_constraint || '>= 0', { path: File.expand_path(file_url[:path]), require: false }]
623

7-
if place_or_version && (git_url = place_or_version.match(git_url_regex))
8-
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9-
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10-
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
1124
else
12-
[place_or_version, { require: false }]
25+
# Plain version constraint → merge opts (including :source if provided)
26+
[place_or_constraint, { require: false }.merge(opts)]
27+
end
28+
end
29+
30+
# Print debug information if DEBUG_GEMS or VERBOSE is set
31+
def print_gem_statement_for(gems)
32+
puts 'DEBUG: Gem definitions that will be generated:'
33+
gems.each do |gem_name, gem_params|
34+
puts "DEBUG: gem #{([gem_name.inspect] + gem_params.map(&:inspect)).join(', ')}"
1335
end
1436
end
1537

1638
group :development do
17-
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
18-
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
19-
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2039
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2140
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2241
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2342
gem "deep_merge", '~> 1.2.2', require: false
2443
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
25-
gem "facterdb", '~> 2.1', require: false
44+
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
45+
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2646
gem "metadata-json-lint", '~> 4.0', require: false
27-
gem "rspec-puppet-facts", '~> 4.0', require: false
47+
gem "json-schema", '< 5.1.1', require: false
48+
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
49+
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2850
gem "dependency_checker", '~> 1.0.0', require: false
2951
gem "parallel_tests", '= 3.12.1', require: false
3052
gem "pry", '~> 0.10', require: false
3153
gem "simplecov-console", '~> 0.9', require: false
32-
gem "puppet-debugger", '~> 1.0', require: false
54+
gem "puppet-debugger", '~> 1.6', require: false
3355
gem "rubocop", '~> 1.50.0', require: false
3456
gem "rubocop-performance", '= 1.16.0', require: false
3557
gem "rubocop-rspec", '= 2.19.0', require: false
3658
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
37-
gem "rexml", '>= 3.3.9', require: false
59+
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3860
end
3961
group :development, :release_prep do
4062
gem "puppet-strings", '~> 4.0', require: false
41-
gem "puppetlabs_spec_helper", '~> 7.0', require: false
63+
gem "puppetlabs_spec_helper", '~> 8.0', require: false
64+
gem "puppet-blacksmith", '~> 7.0', require: false
4265
end
4366
group :system_tests do
44-
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
67+
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
68+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
4569
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
4670
gem "serverspec", '~> 2.41', require: false
4771
end
4872

49-
puppet_version = ENV['PUPPET_GEM_VERSION']
50-
facter_version = ENV['FACTER_GEM_VERSION']
51-
hiera_version = ENV['HIERA_GEM_VERSION']
52-
5373
gems = {}
74+
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
75+
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
76+
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
5477

55-
gems['puppet'] = location_for(puppet_version)
56-
57-
# If facter or hiera versions have been specified via the environment
58-
# variables
59-
60-
gems['facter'] = location_for(facter_version) if facter_version
61-
gems['hiera'] = location_for(hiera_version) if hiera_version
78+
gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore })
79+
gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore })
80+
gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version
6281

82+
# Generate the gem definitions
83+
print_gem_statement_for(gems) if ENV['DEBUG']
6384
gems.each do |gem_name, gem_params|
6485
gem gem_name, *gem_params
6586
end
6687

6788
# Evaluate Gemfile.local and ~/.gemfile if they exist
6889
extra_gemfiles = [
6990
"#{__FILE__}.local",
70-
File.join(Dir.home, '.gemfile'),
91+
File.join(Dir.home, '.gemfile')
7192
]
7293

7394
extra_gemfiles.each do |gemfile|
74-
if File.file?(gemfile) && File.readable?(gemfile)
75-
eval(File.read(gemfile), binding)
76-
end
95+
next unless File.file?(gemfile) && File.readable?(gemfile)
96+
97+
# rubocop:disable Security/Eval
98+
eval(File.read(gemfile), binding)
99+
# rubocop:enable Security/Eval
77100
end
78101
# vim: syntax=ruby

Rakefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@ require 'puppet-syntax/tasks/puppet-syntax'
77
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
88

99
PuppetLint.configuration.send('disable_relative')
10+
PuppetLint.configuration.send('disable_80chars')
11+
PuppetLint.configuration.send('disable_140chars')
12+
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
13+
PuppetLint.configuration.send('disable_autoloader_layout')
14+
PuppetLint.configuration.send('disable_documentation')
15+
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
16+
PuppetLint.configuration.fail_on_warnings = true
17+
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]
18+

metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@
104104
"requirements": [
105105
{
106106
"name": "puppet",
107-
"version_requirement": ">= 7.0.0 < 9.0.0"
107+
"version_requirement": ">= 8.0.0 < 9.0.0"
108108
}
109109
],
110110
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
111-
"template-ref": "tags/3.2.0.4-0-g5d17ec1",
112-
"pdk-version": "3.2.0"
111+
"template-ref": "heads/main-0-g9d5b193",
112+
"pdk-version": "3.5.0"
113113
}

spec/defines/concat_fragment_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@
6161
context 'when content =>' do
6262
['', 'ashp is our hero'].each do |content|
6363
context content do
64-
it_behaves_like 'fragment', 'motd_header', content: content,
64+
it_behaves_like 'fragment', 'motd_header', content:,
6565
target: '/etc/motd'
6666
end
6767
end
6868

6969
context 'when Sensitive' do
7070
let(:title) { 'authentication' }
7171
let(:content) { sensitive('password') }
72-
let(:params) { { content: content, target: '/etc/authentication' } }
72+
let(:params) { { content:, target: '/etc/authentication' } }
7373

7474
it do
75-
expect(subject).to contain_concat_fragment(title).with(content: content)
75+
expect(subject).to contain_concat_fragment(title).with(content:)
7676
end
7777
end
7878

@@ -90,7 +90,7 @@
9090
context 'when source =>' do
9191
['', '/foo/bar', ['/foo/bar', '/foo/baz']].each do |source|
9292
context source do
93-
it_behaves_like 'fragment', 'motd_header', source: source,
93+
it_behaves_like 'fragment', 'motd_header', source:,
9494
target: '/etc/motd'
9595
end
9696
end
@@ -109,7 +109,7 @@
109109
context 'when order =>' do
110110
['', '42', 'a', 'z'].each do |order|
111111
context "'#{order}'" do
112-
it_behaves_like 'fragment', 'motd_header', order: order,
112+
it_behaves_like 'fragment', 'motd_header', order:,
113113
target: '/etc/motd'
114114
end
115115
end

spec/defines/concat_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
let(:params) { params }
4545
let(:facts) do
4646
{
47-
id: id,
47+
id:,
4848
osfamily: 'Debian',
4949
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
5050
kernel: 'Linux',
@@ -139,7 +139,7 @@
139139
['./foo', 'foo', 'foo/bar'].each do |path|
140140
context path do
141141
let(:title) { '/etc/foo.bar' }
142-
let(:params) { { path: path } }
142+
let(:params) { { path: } }
143143

144144
it 'fails' do
145145
expect { catalogue }.to raise_error(Puppet::Error, %r{Stdlib::Unixpath})
@@ -152,7 +152,7 @@
152152
context 'when owner =>' do
153153
['apenney', 1000, '1001'].each do |owner|
154154
context owner do
155-
it_behaves_like 'concat', '/etc/foo.bar', owner: owner
155+
it_behaves_like 'concat', '/etc/foo.bar', owner:
156156
end
157157
end
158158

@@ -170,7 +170,7 @@
170170
context 'when group =>' do
171171
['apenney', 1000, '1001'].each do |group|
172172
context group do
173-
it_behaves_like 'concat', '/etc/foo.bar', group: group
173+
it_behaves_like 'concat', '/etc/foo.bar', group:
174174
end
175175
end
176176

@@ -204,14 +204,14 @@
204204
context 'when warn =>' do
205205
[true, false, '# foo'].each do |warn|
206206
context warn do
207-
it_behaves_like 'concat', '/etc/foo.bar', warn: warn
207+
it_behaves_like 'concat', '/etc/foo.bar', warn:
208208
end
209209
end
210210

211211
context 'when (stringified boolean)' do
212212
['true', 'yes', 'on', 'false', 'no', 'off'].each do |warn|
213213
define warn do
214-
it_behaves_like 'concat', '/etc/foo.bar', warn: warn
214+
it_behaves_like('concat', '/etc/foo.bar', warn:)
215215

216216
it 'creates a warning' do
217217
skip('rspec-puppet support for testing warning()')
@@ -234,7 +234,7 @@
234234
context 'when show_diff =>' do
235235
[true, false].each do |show_diff|
236236
context show_diff do
237-
it_behaves_like 'concat', '/etc/foo.bar', show_diff: show_diff
237+
it_behaves_like 'concat', '/etc/foo.bar', show_diff:
238238
end
239239
end
240240

@@ -252,7 +252,7 @@
252252
context 'when backup =>' do
253253
['reverse', false, true].each do |backup|
254254
context backup.to_s do
255-
it_behaves_like 'concat', '/etc/foo.bar', backup: backup
255+
it_behaves_like 'concat', '/etc/foo.bar', backup:
256256
end
257257
end
258258

@@ -270,7 +270,7 @@
270270
context 'when replace =>' do
271271
[true, false].each do |replace|
272272
context replace do
273-
it_behaves_like 'concat', '/etc/foo.bar', replace: replace
273+
it_behaves_like 'concat', '/etc/foo.bar', replace:
274274
end
275275
end
276276

@@ -288,7 +288,7 @@
288288
context 'when force =>' do
289289
[true, false].each do |force|
290290
context force do
291-
it_behaves_like 'concat', '/etc/foo.bar', force: force
291+
it_behaves_like 'concat', '/etc/foo.bar', force:
292292
end
293293
end
294294

@@ -306,7 +306,7 @@
306306
context 'when order =>' do
307307
['alpha', 'numeric'].each do |order|
308308
context order do
309-
it_behaves_like 'concat', '/etc/foo.bar', order: order
309+
it_behaves_like 'concat', '/etc/foo.bar', order:
310310
end
311311
end
312312

@@ -324,7 +324,7 @@
324324
context 'when ensure_newline =>' do
325325
[true, false].each do |ensure_newline|
326326
context 'when true' do
327-
it_behaves_like 'concat', '/etc/foo.bar', ensure_newline: ensure_newline
327+
it_behaves_like 'concat', '/etc/foo.bar', ensure_newline:
328328
end
329329
end
330330

0 commit comments

Comments
 (0)