Skip to content

Commit 553aeff

Browse files
(main) Update PDK to 3.4.0
Updates the module to PDK 3.4.0 with minimal changes: - Updates gem dependencies for Ruby 3.x compatibility - Updates CI workflow configuration - All unit tests passing with 6 expected pending tests - No functional changes to module code
1 parent 998d169 commit 553aeff

File tree

10 files changed

+87
-135
lines changed

10 files changed

+87
-135
lines changed

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,25 @@
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
2934
.rerun.json
35+
bolt-debug.log
3036
*.tar.gz
3137
.modules/
32-
.plan_cache.json
3338
.resource_types/
34-
bolt-debug.log
3539
spec/docker/**/*.tar.gz
3640
spec/docker/**/*.asc
3741
spec/docker/**/files/puppet-enterprise*
3842
spec/docker/.task_cache.json
43+
.vscode/

.pdkignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@
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
39+
/.github/
3240
/.gitignore
3341
/.pdkignore
3442
/.puppet-lint.rc

.puppet-lint.rc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
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+
--no-strict_indent-check
10+
--no-manifest_whitespace_missing_newline_end_of_file-check
11+
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp

.rubocop.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
11
---
2-
require:
3-
- rubocop-performance
4-
- rubocop-rspec
2+
require: [rubocop-performance, rubocop-rspec]
53
AllCops:
6-
Newcops: enable
7-
ExtraDetails: true
8-
DisplayStyleGuide: true
4+
NewCops: enable
95
DisplayCopNames: true
10-
TargetRubyVersion: '2.7'
11-
Include:
12-
- "**/*.rb"
6+
TargetRubyVersion: '2.6'
7+
Include: ['**/*.rb']
138
Exclude:
14-
- bin/*
15-
- ".vendor/**/*"
16-
- "**/Gemfile"
17-
- "**/Rakefile"
18-
- pkg/**/*
19-
- spec/fixtures/**/*
20-
- vendor/**/*
21-
- "**/Puppetfile"
22-
- "**/Vagrantfile"
23-
- "**/Guardfile"
9+
- bin/*
10+
- .vendor/**/*
11+
- '**/Gemfile'
12+
- '**/Rakefile'
13+
- pkg/**/*
14+
- spec/fixtures/**/*
15+
- vendor/**/*
16+
- '**/Puppetfile'
17+
- '**/Vagrantfile'
18+
- '**/Guardfile'
2419
Layout/LineLength:
2520
Description: People have wide screens, use them.
2621
Max: 200
2722
RSpec/BeforeAfterAll:
2823
Description: Beware of using after(:all) as it may cause state to leak between tests.
2924
A necessary evil in acceptance testing.
30-
Exclude:
31-
- spec/acceptance/**/*.rb
25+
Exclude: [spec/acceptance/**/*.rb]
3226
RSpec/HookArgument:
3327
Description: Prefer explicit :each argument, matching existing module's style
3428
EnforcedStyle: each
3529
RSpec/DescribeSymbol:
36-
Exclude:
37-
- spec/unit/facter/**/*.rb
30+
Exclude: [spec/unit/facter/**/*.rb]
3831
Style/BlockDelimiters:
3932
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
4033
be consistent then.
@@ -77,9 +70,7 @@ Style/SymbolArray:
7770
RSpec/MessageSpies:
7871
EnforcedStyle: receive
7972
Style/Documentation:
80-
Exclude:
81-
- lib/puppet/parser/functions/**/*
82-
- spec/**/*
73+
Exclude: [lib/puppet/parser/functions/**/*, spec/**/*]
8374
Style/WordArray:
8475
EnforcedStyle: brackets
8576
Performance/AncestorsInclude:
@@ -530,6 +521,8 @@ Lint/DuplicateBranch:
530521
Enabled: false
531522
Lint/DuplicateMagicComment:
532523
Enabled: false
524+
Lint/DuplicateMatchPattern:
525+
Enabled: false
533526
Lint/DuplicateRegexpCharacterClassElement:
534527
Enabled: false
535528
Lint/EmptyBlock:
@@ -646,6 +639,8 @@ Style/ComparableClamp:
646639
Enabled: false
647640
Style/ConcatArrayLiterals:
648641
Enabled: false
642+
Style/DataInheritance:
643+
Enabled: false
649644
Style/DirEmpty:
650645
Enabled: false
651646
Style/DocumentDynamicEvalDefinition:
@@ -714,6 +709,8 @@ Style/RedundantHeredocDelimiterQuotes:
714709
Enabled: false
715710
Style/RedundantInitialize:
716711
Enabled: false
712+
Style/RedundantLineContinuation:
713+
Enabled: false
717714
Style/RedundantSelfAssignmentBranch:
718715
Enabled: false
719716
Style/RedundantStringEscape:

.sync.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
Gemfile:
33
required:
4-
':development':
4+
:development:
55
- gem: bolt
66
version: '>= 3.10.0'
77
optional:
8-
':development':
8+
:development:
99
- gem: github_changelog_generator
1010
version: 1.16.4 # Pinned to latest bug fix version
1111
- gem: octokit
1212
version: 4.21.0 # Locked due to https://github.com/octokit/octokit.rb/issues/1391
1313
# The Faraday requirements in orchestrator_client 0.7.1 causes Bundler to
1414
# resolve the dependency in unexpected ways and causes issues in CI
1515
- gem: orchestrator_client
16-
version: '< 0.7.1'
16+
version: < 0.7.1
1717
Rakefile:
1818
changelog_since_tag: 2.5.0
1919
default_disabled_lint_checks:
@@ -23,7 +23,7 @@ Rakefile:
2323
- PuppetSyntax.exclude_paths = ["plans/**/*.pp", "spec/acceptance/**/plans/**/*.pp",
2424
"vendor/**/*"]
2525
spec/spec_helper.rb:
26-
mock_with: ':rspec'
26+
mock_with: :rspec
2727
.gitignore:
2828
paths:
2929
- .rerun.json

Gemfile

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,37 @@ group :development do
2020
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))
2121
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))
2222
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.2.2', require: false
2324
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
24-
gem "facterdb", '~> 1.18', require: false
25-
gem "metadata-json-lint", '~> 3.0', require: false
26-
gem "puppetlabs_spec_helper", '~> 6.0', require: false
27-
gem "rspec-puppet-facts", '~> 2.0', require: false
28-
gem "codecov", '~> 0.2', require: false
25+
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
26+
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
27+
gem "metadata-json-lint", '~> 4.0', require: false
28+
gem "json-schema", '< 5.1.1', require: false
29+
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
30+
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2931
gem "dependency_checker", '~> 1.0.0', require: false
3032
gem "parallel_tests", '= 3.12.1', require: false
3133
gem "pry", '~> 0.10', require: false
32-
gem "simplecov-console", '~> 0.5', require: false
34+
gem "simplecov-console", '~> 0.9', require: false
3335
gem "puppet-debugger", '~> 1.0', require: false
34-
gem "rubocop", '= 1.48.1', require: false
36+
gem "rubocop", '~> 1.50.0', require: false
3537
gem "rubocop-performance", '= 1.16.0', require: false
3638
gem "rubocop-rspec", '= 2.19.0', require: false
3739
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
38-
gem "bolt", '>= 3.27.2', require: false
40+
gem "bolt", '>= 3.10.0', require: false
3941
gem "github_changelog_generator", '1.16.4', require: false
4042
gem "octokit", '4.21.0', require: false
4143
gem "orchestrator_client", '< 0.7.1', require: false
4244
end
43-
group :system_tests do
44-
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
45-
gem "serverspec", '~> 2.41', require: false
46-
end
47-
group :release_prep do
45+
group :development, :release_prep do
4846
gem "puppet-strings", '~> 4.0', require: false
49-
gem "puppetlabs_spec_helper", '~> 6.0', require: false
47+
gem "puppetlabs_spec_helper", '~> 8.0', require: false
48+
gem "puppet-blacksmith", '~> 7.0', require: false
49+
end
50+
group :system_tests do
51+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
52+
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
53+
gem "serverspec", '~> 2.41', require: false
5054
end
5155

5256
puppet_version = ENV['PUPPET_GEM_VERSION']

Rakefile

Lines changed: 8 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,18 @@ require 'bundler'
44
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
55
require 'puppetlabs_spec_helper/rake_tasks'
66
require 'puppet-syntax/tasks/puppet-syntax'
7-
require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator'
87
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
98

10-
def changelog_user
11-
return unless Rake.application.top_level_tasks.include? "changelog"
12-
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
13-
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
14-
puts "GitHubChangelogGenerator user:#{returnVal}"
15-
returnVal
16-
end
17-
18-
def changelog_project
19-
return unless Rake.application.top_level_tasks.include? "changelog"
20-
21-
returnVal = nil
22-
returnVal ||= begin
23-
metadata_source = JSON.load(File.read('metadata.json'))['source']
24-
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
25-
26-
metadata_source_match && metadata_source_match[1]
27-
end
28-
29-
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
30-
31-
puts "GitHubChangelogGenerator project:#{returnVal}"
32-
returnVal
33-
end
34-
35-
def changelog_future_release
36-
return unless Rake.application.top_level_tasks.include? "changelog"
37-
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
38-
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
39-
puts "GitHubChangelogGenerator future_release:#{returnVal}"
40-
returnVal
41-
end
42-
439
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')
4416
PuppetLint.configuration.send('disable_strict_indent')
4517
PuppetLint.configuration.send('disable_manifest_whitespace_missing_newline_end_of_file')
46-
47-
48-
if Gem.loaded_specs.key? 'github_changelog_generator'
49-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
50-
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
51-
config.user = "#{changelog_user}"
52-
config.project = "#{changelog_project}"
53-
config.since_tag = "2.5.0"
54-
config.future_release = "#{changelog_future_release}"
55-
config.exclude_labels = ['maintenance']
56-
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
57-
config.add_pr_wo_labels = true
58-
config.issues = false
59-
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
60-
config.configure_sections = {
61-
"Changed" => {
62-
"prefix" => "### Changed",
63-
"labels" => ["backwards-incompatible"],
64-
},
65-
"Added" => {
66-
"prefix" => "### Added",
67-
"labels" => ["enhancement", "feature"],
68-
},
69-
"Fixed" => {
70-
"prefix" => "### Fixed",
71-
"labels" => ["bug", "documentation", "bugfix"],
72-
},
73-
}
74-
end
75-
else
76-
desc 'Generate a Changelog from GitHub'
77-
task :changelog do
78-
raise <<EOM
79-
The changelog tasks depends on recent features of the github_changelog_generator gem.
80-
Please manually add it to your .sync.yml for now, and run `pdk update`:
81-
---
82-
Gemfile:
83-
optional:
84-
':development':
85-
- gem: 'github_changelog_generator'
86-
version: '~> 1.15'
87-
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
88-
EOM
89-
end
90-
end
18+
PuppetLint.configuration.fail_on_warnings = true
19+
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]
9120

9221
PuppetSyntax.exclude_paths = ["plans/**/*.pp", "spec/acceptance/**/plans/**/*.pp", "vendor/**/*"]

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"version_requirement": ">= 7.0.0 < 9.0.0"
8787
}
8888
],
89-
"pdk-version": "3.0.0",
89+
"pdk-version": "3.4.0",
9090
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
91-
"template-ref": "tags/3.0.0-0-g056e50d"
91+
"template-ref": "tags/3.4.0.3-0-g8fb22fc"
9292
}

spec/default_facts.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Use default_module_facts.yml for module specific facts.
2-
#
3-
# Facts specified here will override the values provided by rspec-puppet-facts.
41
---
5-
ipaddress: "172.16.254.254"
6-
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
2+
networking:
3+
ip: 172.16.254.254
4+
ip6: FE80:0000:0000:0000:AAAA:AAAA:AAAA
5+
mac: AA:AA:AA:AA:AA:AA
76
is_pe: false
8-
macaddress: "AA:AA:AA:AA:AA:AA"

spec/spec_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
2626

2727
begin
28-
default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
28+
require 'deep_merge'
29+
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
2930
rescue StandardError => e
3031
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
3132
end
3233
end
3334

3435
# read default_facts and merge them over what is provided by facterdb
3536
default_facts.each do |fact, value|
36-
add_custom_fact fact, value
37+
add_custom_fact fact, value, merge_facts: true
3738
end
3839

3940
RSpec.configure do |c|

0 commit comments

Comments
 (0)