Skip to content

Commit f855bf0

Browse files
authored
Merge pull request #51 from puppetlabs/PA-7815-template-351-updates
(PA-7815) template 3.5.1 updates
2 parents d02e4aa + a43411f commit f855bf0

File tree

8 files changed

+90
-39
lines changed

8 files changed

+90
-39
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log

.pdkignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log
2936
/.fixtures.yml
3037
/Gemfile
3138
/.gitattributes

.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: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +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))
23-
gem "deep_merge", '~> 1.0', require: false
42+
gem "deep_merge", '~> 1.2.2', require: false
2443
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
25-
gem "facterdb", '~> 1.18', 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", '~> 3.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]
59+
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3760
end
3861
group :development, :release_prep do
3962
gem "puppet-strings", '~> 4.0', require: false
40-
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
4165
end
4266
group :system_tests do
43-
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?
4469
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
4570
gem "serverspec", '~> 2.41', require: false
46-
gem "voxpupuli-acceptance", require: false
4771
end
4872

4973
gems = {}
5074
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
5175
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
5276
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
5377

54-
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
55-
# Otherwise, do as before and use location_for to fetch gems from the default source
56-
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
57-
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
58-
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
59-
else
60-
gems['puppet'] = location_for(puppet_version)
61-
gems['facter'] = location_for(facter_version) if facter_version
62-
end
63-
64-
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
6581

82+
# Generate the gem definitions
83+
print_gem_statement_for(gems) if ENV['DEBUG']
6684
gems.each do |gem_name, gem_params|
6785
gem gem_name, *gem_params
6886
end
6987

7088
# Evaluate Gemfile.local and ~/.gemfile if they exist
7189
extra_gemfiles = [
7290
"#{__FILE__}.local",
73-
File.join(Dir.home, '.gemfile'),
91+
File.join(Dir.home, '.gemfile')
7492
]
7593

7694
extra_gemfiles.each do |gemfile|
77-
if File.file?(gemfile) && File.readable?(gemfile)
78-
eval(File.read(gemfile), binding)
79-
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
80100
end
81101
# 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
@@ -57,7 +57,7 @@
5757
"version_requirement": ">= 6.0.0 < 9.0.0"
5858
}
5959
],
60-
"pdk-version": "3.2.0",
61-
"template-url": "https://github.com/puppetlabs/pdk-templates#3.2.0",
62-
"template-ref": "tags/3.2.0-0-gb257ef1"
60+
"pdk-version": "3.5.1",
61+
"template-url": "https://github.com/puppetlabs/pdk-templates#3.5.1",
62+
"template-ref": "tags/3.5.1-0-g9d5b193"
6363
}

spec/unit/provider/selmodule_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'stringio'
88

99
describe Puppet::Type.type(:selmodule).provider(:semodule) do
10-
let(:resource) { instance_double('resource', name: name) }
10+
let(:resource) { instance_double('resource', name:) }
1111
let(:provider) { described_class.new(resource) }
1212

1313
before :each do

0 commit comments

Comments
 (0)