Skip to content

Commit d49a05d

Browse files
committed
pdk update
1 parent 1ae67ee commit d49a05d

14 files changed

+116
-75
lines changed

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@
2222
/convert_report.txt
2323
/update_report.txt
2424
.DS_Store
25-
.ruby-version
25+
.project
26+
.envrc
27+
/inventory.yaml

Diff for: .gitlab-ci.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ cache:
1010
before_script:
1111
- bundle -v
1212
- rm Gemfile.lock || true
13-
- gem update --system
13+
- gem update --system $RUBYGEMS_VERSION
1414
- gem --version
1515
- bundle -v
1616
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
1717

18-
parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
19-
stage: unit
20-
image: ruby:2.1.9
18+
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.3-Puppet ~> 6:
19+
stage: syntax
20+
image: ruby:2.5.3
2121
script:
22-
- bundle exec rake parallel_spec
22+
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
2323
variables:
24-
PUPPET_GEM_VERSION: '~> 4.0'
24+
PUPPET_GEM_VERSION: '~> 6'
2525

26-
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
27-
stage: syntax
28-
image: ruby:2.4.4
26+
parallel_spec-Ruby 2.5.3-Puppet ~> 6:
27+
stage: unit
28+
image: ruby:2.5.3
2929
script:
30-
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
30+
- bundle exec rake parallel_spec
3131
variables:
32-
PUPPET_GEM_VERSION: '~> 5.5'
32+
PUPPET_GEM_VERSION: '~> 6'
3333

34-
parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
34+
parallel_spec-Ruby 2.4.5-Puppet ~> 5:
3535
stage: unit
36-
image: ruby:2.4.4
36+
image: ruby:2.4.5
3737
script:
3838
- bundle exec rake parallel_spec
3939
variables:
40-
PUPPET_GEM_VERSION: '~> 5.5'
40+
PUPPET_GEM_VERSION: '~> 5'
4141

Diff for: .pdkignore

+18
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,21 @@
2222
/convert_report.txt
2323
/update_report.txt
2424
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml
28+
/appveyor.yml
29+
/.fixtures.yml
30+
/Gemfile
31+
/.gitattributes
32+
/.gitignore
33+
/.gitlab-ci.yml
34+
/.pdkignore
35+
/Rakefile
36+
/rakelib/
37+
/.rspec
38+
/.rubocop.yml
39+
/.travis.yml
40+
/.yardopts
41+
/spec/
42+
/.vscode/

Diff for: .puppet-lint.rc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--relative

Diff for: .rubocop.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
2-
require: rubocop-rspec
2+
require:
3+
- rubocop-rspec
4+
- rubocop-i18n
35
AllCops:
46
DisplayCopNames: true
57
TargetRubyVersion: '2.1'
@@ -19,10 +21,13 @@ AllCops:
1921
Metrics/LineLength:
2022
Description: People have wide screens, use them.
2123
Max: 200
24+
GetText:
25+
Enabled: false
2226
GetText/DecorateString:
2327
Description: We don't want to decorate test output.
2428
Exclude:
25-
- spec/*
29+
- spec/**/*
30+
Enabled: false
2631
RSpec/BeforeAfterAll:
2732
Description: Beware of using after(:all) as it may cause state to leak between tests.
2833
A necessary evil in acceptance testing.
@@ -84,6 +89,12 @@ Style/MethodCalledOnDoEndBlock:
8489
Enabled: true
8590
Style/StringMethods:
8691
Enabled: true
92+
GetText/DecorateFunctionMessage:
93+
Enabled: false
94+
GetText/DecorateStringFormattingUsingInterpolation:
95+
Enabled: false
96+
GetText/DecorateStringFormattingUsingPercent:
97+
Enabled: false
8798
Layout/EndOfLine:
8899
Enabled: false
89100
Layout/IndentHeredoc:

Diff for: .ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.2

Diff for: .travis.yml

+20-27
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,45 @@
11
---
2-
sudo: false
3-
dist: trusty
2+
dist: xenial
43
language: ruby
54
cache: bundler
65
before_install:
76
- bundle -v
87
- rm -f Gemfile.lock
9-
- gem update --system
8+
- gem update --system $RUBYGEMS_VERSION
109
- gem --version
1110
- bundle -v
1211
script:
1312
- 'bundle exec rake $CHECK'
1413
bundler_args: --without system_tests
1514
rvm:
16-
- 2.5.1
17-
env:
18-
global:
19-
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
15+
- 2.5.3
16+
stages:
17+
- static
18+
- spec
19+
- acceptance
20+
-
21+
if: tag =~ ^v\d
22+
name: deploy
2023
matrix:
2124
fast_finish: true
2225
include:
2326
-
24-
bundler_args:
25-
dist: trusty
26-
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
27-
rvm: 2.5.1
28-
script: bundle exec rake beaker
29-
services: docker
30-
sudo: required
27+
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
28+
stage: static
3129
-
32-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
30+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
31+
rvm: 2.4.5
32+
stage: spec
3333
-
34-
env: CHECK=parallel_spec
34+
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
35+
rvm: 2.5.3
36+
stage: spec
3537
-
36-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
37-
rvm: 2.4.4
38+
env: DEPLOY_TO_FORGE=yes
39+
stage: deploy
3840
branches:
3941
only:
4042
- master
4143
- /^v\d/
4244
notifications:
4345
email: false
44-
deploy:
45-
provider: puppetforge
46-
user: puppet
47-
password:
48-
secure: ""
49-
on:
50-
tags: true
51-
all_branches: true
52-
condition: "$DEPLOY_TO_FORGE = yes"

Diff for: .vscode/extensions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"jpogran.puppet-vscode",
4+
"rebornix.Ruby"
5+
]
6+
}

Diff for: Gemfile

+11-16
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,17 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
1717
minor_version = ruby_version_segments[0..1].join('.')
1818

1919
group :development do
20-
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
21-
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
22-
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
23-
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
24-
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
25-
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))
26-
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
27-
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
28-
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
29-
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
30-
gem "puppet-lint-i18n", require: false
31-
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
32-
end
33-
group :system_tests do
34-
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
35-
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
20+
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
21+
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
22+
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
23+
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
24+
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
25+
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))
26+
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27+
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
28+
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
29+
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30+
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3631
end
3732

3833
puppet_version = ENV['PUPPET_GEM_VERSION']

Diff for: Rakefile

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
12
require 'puppetlabs_spec_helper/rake_tasks'
23
require 'puppet-syntax/tasks/puppet-syntax'
34
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
@@ -14,15 +15,24 @@ end
1415

1516
def changelog_project
1617
return unless Rake.application.top_level_tasks.include? "changelog"
17-
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
18-
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
18+
19+
returnVal = nil
20+
returnVal ||= begin
21+
metadata_source = JSON.load(File.read('metadata.json'))['source']
22+
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
23+
24+
metadata_source_match && metadata_source_match[1]
25+
end
26+
27+
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
28+
1929
puts "GitHubChangelogGenerator project:#{returnVal}"
2030
returnVal
2131
end
2232

2333
def changelog_future_release
2434
return unless Rake.application.top_level_tasks.include? "changelog"
25-
returnVal = JSON.load(File.read('metadata.json'))['version']
35+
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
2636
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
2737
puts "GitHubChangelogGenerator future_release:#{returnVal}"
2838
returnVal

Diff for: appveyor.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: 1.1.x.{build}
33
branches:
44
only:
55
- master
6+
- release
67
skip_commits:
78
message: /^\(?doc\)?.*/
89
clone_depth: 10
@@ -17,14 +18,6 @@ environment:
1718
-
1819
RUBY_VERSION: 24-x64
1920
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
20-
-
21-
PUPPET_GEM_VERSION: ~> 4.0
22-
RUBY_VERSION: 21
23-
CHECK: parallel_spec
24-
-
25-
PUPPET_GEM_VERSION: ~> 4.0
26-
RUBY_VERSION: 21-x64
27-
CHECK: parallel_spec
2821
-
2922
PUPPET_GEM_VERSION: ~> 5.0
3023
RUBY_VERSION: 24

Diff for: metadata.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"version_requirement": ">= 4.10.0 < 7.0.0"
3232
}
3333
],
34-
"pdk-version": "1.8.0",
35-
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
36-
"template-ref": "1.8.0-0-g0d9da00"
34+
"pdk-version": "1.15.0",
35+
"template-url": "https://github.com/puppetlabs/pdk-templates#1.15.0",
36+
"template-ref": "tags/1.15.0-0-g0bc522e"
3737
}

Diff for: spec/default_facts.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
# Facts specified here will override the values provided by rspec-puppet-facts.
44
---
55
ipaddress: "172.16.254.254"
6+
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
67
is_pe: false
78
macaddress: "AA:AA:AA:AA:AA:AA"

Diff for: spec/spec_helper.rb

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,31 @@
1919
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
2020

2121
begin
22-
default_facts.merge!(YAML.safe_load(File.read(f)))
22+
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
2323
rescue => e
2424
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
2525
end
2626
end
2727

28+
# read default_facts and merge them over what is provided by facterdb
29+
default_facts.each do |fact, value|
30+
add_custom_fact fact, value
31+
end
32+
2833
RSpec.configure do |c|
2934
c.default_facts = default_facts
3035
c.before :each do
3136
# set to strictest setting for testing
3237
# by default Puppet runs at warning level
3338
Puppet.settings[:strict] = :warning
3439
end
40+
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
41+
c.after(:suite) do
42+
end
3543
end
3644

45+
# Ensures that a module is defined
46+
# @param module_name Name of the module
3747
def ensure_module_defined(module_name)
3848
module_name.split('::').reduce(Object) do |last_module, next_module|
3949
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)

0 commit comments

Comments
 (0)