aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaibuzgau <mihai.buzgau@puppet.com>2019-10-24 13:58:09 +0300
committermihaibuzgau <mihai.buzgau@puppet.com>2019-10-24 16:41:14 +0300
commitcb746fccd6afce502072dccd8aa57e2f645d9d45 (patch)
treec54ac020dd8712d8a2235385ccd5da1e94b14b3c
parent0e6e663b82b12d0d5ce4f2fe0c41e6289c88efae (diff)
downloadpuppet-cron_core-cb746fccd6afce502072dccd8aa57e2f645d9d45.tar.gz
puppet-cron_core-cb746fccd6afce502072dccd8aa57e2f645d9d45.tar.bz2
(maint) Update module using PDK 1.14.0
-rw-r--r--.gitignore3
-rw-r--r--.pdkignore5
-rw-r--r--.rubocop.yml15
-rw-r--r--.travis.yml38
-rw-r--r--.vscode/extensions.json6
-rw-r--r--Gemfile23
-rw-r--r--Rakefile16
-rw-r--r--data/common.yaml1
-rw-r--r--hiera.yaml21
-rw-r--r--metadata.json6
-rw-r--r--spec/default_facts.yml1
-rw-r--r--spec/spec_helper.rb9
12 files changed, 106 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore
index 650022e..2767022 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,6 @@
/convert_report.txt
/update_report.txt
.DS_Store
+.project
+.envrc
+/inventory.yaml
diff --git a/.pdkignore b/.pdkignore
index b713b3b..e6215cd 100644
--- a/.pdkignore
+++ b/.pdkignore
@@ -22,6 +22,9 @@
/convert_report.txt
/update_report.txt
.DS_Store
+.project
+.envrc
+/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
@@ -30,8 +33,10 @@
/.gitlab-ci.yml
/.pdkignore
/Rakefile
+/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
+/.vscode/
diff --git a/.rubocop.yml b/.rubocop.yml
index c3ab58e..3500164 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,5 +1,7 @@
---
-require: rubocop-rspec
+require:
+- rubocop-rspec
+- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
@@ -19,10 +21,13 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 260
+GetText:
+ Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- - spec/*
+ - spec/**/*
+ Enabled: false
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
@@ -86,6 +91,12 @@ Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
+GetText/DecorateFunctionMessage:
+ Enabled: false
+GetText/DecorateStringFormattingUsingInterpolation:
+ Enabled: false
+GetText/DecorateStringFormattingUsingPercent:
+ Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
diff --git a/.travis.yml b/.travis.yml
index 521510d..ed27d4d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
---
-dist: trusty
+dist: xenial
language: ruby
cache: bundler
before_install:
@@ -12,32 +12,34 @@ script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- - 2.5.1
-env:
- global:
- - BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
+ - 2.5.3
+stages:
+ - static
+ - spec
+ - acceptance
+ -
+ if: tag =~ ^v\d
+ name: deploy
matrix:
fast_finish: true
include:
-
- env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
- -
- env: CHECK=parallel_spec
+ env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
+ stage: static
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
- rvm: 2.4.4
+ rvm: 2.4.5
+ stage: spec
+ -
+ env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
+ rvm: 2.5.3
+ stage: spec
+ -
+ env: DEPLOY_TO_FORGE=yes
+ stage: deploy
branches:
only:
- master
- /^v\d/
notifications:
email: false
-deploy:
- provider: puppetforge
- user: puppet
- password:
- secure: ""
- on:
- tags: true
- all_branches: true
- condition: "$DEPLOY_TO_FORGE = yes"
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..6177782
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "jpogran.puppet-vscode",
+ "rebornix.Ruby"
+ ]
+}
diff --git a/Gemfile b/Gemfile
index 81d8791..aabb09e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -17,17 +17,18 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')
group :development do
- gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
- gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
- gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
- gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
- gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
- 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))
- gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
- gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
- gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
- gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
- 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')
+ gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
+ gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
+ gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
+ gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
+ gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
+ 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))
+ gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
+ gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
+ gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ 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')
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
diff --git a/Rakefile b/Rakefile
index a6b14c5..395df54 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,4 @@
+require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
@@ -14,15 +15,24 @@ end
def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
- returnVal = nil || JSON.load(File.read('metadata.json'))['name']
- raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
+
+ returnVal = nil
+ returnVal ||= begin
+ metadata_source = JSON.load(File.read('metadata.json'))['source']
+ metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
+
+ metadata_source_match && metadata_source_match[1]
+ end
+
+ raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
+
puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end
def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
- returnVal = JSON.load(File.read('metadata.json'))['version']
+ returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
diff --git a/data/common.yaml b/data/common.yaml
new file mode 100644
index 0000000..ed97d53
--- /dev/null
+++ b/data/common.yaml
@@ -0,0 +1 @@
+---
diff --git a/hiera.yaml b/hiera.yaml
new file mode 100644
index 0000000..2251c23
--- /dev/null
+++ b/hiera.yaml
@@ -0,0 +1,21 @@
+---
+version: 5
+
+defaults: # Used for any hierarchy level that omits these keys.
+ datadir: data # This path is relative to hiera.yaml's directory.
+ data_hash: yaml_data # Use the built-in YAML backend.
+
+hierarchy:
+ - name: "osfamily/major release"
+ paths:
+ - "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
+ # Used for Solaris
+ - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml"
+ # Used to distinguish between Debian and Ubuntu
+ - "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
+ - name: "osfamily"
+ paths:
+ - "os/%{facts.os.family}.yaml"
+ - "os/%{facts.os.name}.yaml"
+ - name: 'common'
+ path: 'common.yaml'
diff --git a/metadata.json b/metadata.json
index 9924bd2..f73efe0 100644
--- a/metadata.json
+++ b/metadata.json
@@ -78,7 +78,7 @@
"version_requirement": ">= 6.0.0 < 7.0.0"
}
],
- "pdk-version": "1.9.0",
- "template-url": "https://github.com/puppetlabs/pdk-templates/",
- "template-ref": "1.9.0-0-g7281db5"
+ "pdk-version": "1.14.0",
+ "template-url": "https://github.com/puppetlabs/pdk-templates#1.14.0",
+ "template-ref": "1.14.0-0-g1bf3a4e"
}
diff --git a/spec/default_facts.yml b/spec/default_facts.yml
index ea1e480..f777abf 100644
--- a/spec/default_facts.yml
+++ b/spec/default_facts.yml
@@ -3,5 +3,6 @@
# Facts specified here will override the values provided by rspec-puppet-facts.
---
ipaddress: "172.16.254.254"
+ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 0d5efc0..feb5720 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,12 +19,17 @@ default_fact_files.each do |f|
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
begin
- default_facts.merge!(YAML.safe_load(File.read(f)))
+ default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
rescue => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
end
+# read default_facts and merge them over what is provided by facterdb
+default_facts.each do |fact, value|
+ add_custom_fact fact, value
+end
+
RSpec.configure do |c|
c.default_facts = default_facts
c.before :each do
@@ -37,6 +42,8 @@ RSpec.configure do |c|
end
end
+# Ensures that a module is defined
+# @param module_name Name of the module
def ensure_module_defined(module_name)
module_name.split('::').reduce(Object) do |last_module, next_module|
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)