Convert the module to be PDK compliant
This commit is contained in:
parent
3f950c460d
commit
229026aa41
32
.gitignore
vendored
32
.gitignore
vendored
@ -1,10 +1,24 @@
|
|||||||
pkg/
|
.git/
|
||||||
Gemfile.lock
|
.*.sw[op]
|
||||||
vendor/
|
.metadata
|
||||||
spec/fixtures/
|
.yardoc
|
||||||
.vagrant/
|
.yardwarns
|
||||||
.bundle/
|
|
||||||
coverage/
|
|
||||||
.idea/
|
|
||||||
*.iml
|
*.iml
|
||||||
.settings/
|
/.bundle/
|
||||||
|
/.idea/
|
||||||
|
/.vagrant/
|
||||||
|
/coverage/
|
||||||
|
/bin/
|
||||||
|
/doc/
|
||||||
|
/Gemfile.local
|
||||||
|
/Gemfile.lock
|
||||||
|
/junit/
|
||||||
|
/log/
|
||||||
|
/pkg/
|
||||||
|
/spec/fixtures/manifests/
|
||||||
|
/spec/fixtures/modules/
|
||||||
|
/tmp/
|
||||||
|
/vendor/
|
||||||
|
/convert_report.txt
|
||||||
|
/update_report.txt
|
||||||
|
.DS_Store
|
||||||
|
41
.gitlab-ci.yml
Normal file
41
.gitlab-ci.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
stages:
|
||||||
|
- syntax
|
||||||
|
- unit
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- vendor/bundle
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- bundle -v
|
||||||
|
- rm Gemfile.lock || true
|
||||||
|
- gem update --system
|
||||||
|
- gem --version
|
||||||
|
- bundle -v
|
||||||
|
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
|
||||||
|
|
||||||
|
parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
|
||||||
|
stage: unit
|
||||||
|
image: ruby:2.1.9
|
||||||
|
script:
|
||||||
|
- bundle exec rake parallel_spec
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 4.0'
|
||||||
|
|
||||||
|
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
|
||||||
|
stage: syntax
|
||||||
|
image: ruby:2.4.4
|
||||||
|
script:
|
||||||
|
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 5.5'
|
||||||
|
|
||||||
|
parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
|
||||||
|
stage: unit
|
||||||
|
image: ruby:2.4.4
|
||||||
|
script:
|
||||||
|
- bundle exec rake parallel_spec
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 5.5'
|
||||||
|
|
24
.pdkignore
Normal file
24
.pdkignore
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
.git/
|
||||||
|
.*.sw[op]
|
||||||
|
.metadata
|
||||||
|
.yardoc
|
||||||
|
.yardwarns
|
||||||
|
*.iml
|
||||||
|
/.bundle/
|
||||||
|
/.idea/
|
||||||
|
/.vagrant/
|
||||||
|
/coverage/
|
||||||
|
/bin/
|
||||||
|
/doc/
|
||||||
|
/Gemfile.local
|
||||||
|
/Gemfile.lock
|
||||||
|
/junit/
|
||||||
|
/log/
|
||||||
|
/pkg/
|
||||||
|
/spec/fixtures/manifests/
|
||||||
|
/spec/fixtures/modules/
|
||||||
|
/tmp/
|
||||||
|
/vendor/
|
||||||
|
/convert_report.txt
|
||||||
|
/update_report.txt
|
||||||
|
.DS_Store
|
118
.rubocop.yml
Normal file
118
.rubocop.yml
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
---
|
||||||
|
require: rubocop-rspec
|
||||||
|
AllCops:
|
||||||
|
DisplayCopNames: true
|
||||||
|
TargetRubyVersion: '2.1'
|
||||||
|
Include:
|
||||||
|
- "./**/*.rb"
|
||||||
|
Exclude:
|
||||||
|
- bin/*
|
||||||
|
- ".vendor/**/*"
|
||||||
|
- "**/Gemfile"
|
||||||
|
- "**/Rakefile"
|
||||||
|
- pkg/**/*
|
||||||
|
- spec/fixtures/**/*
|
||||||
|
- vendor/**/*
|
||||||
|
- "**/Puppetfile"
|
||||||
|
- "**/Vagrantfile"
|
||||||
|
- "**/Guardfile"
|
||||||
|
Metrics/LineLength:
|
||||||
|
Description: People have wide screens, use them.
|
||||||
|
Max: 200
|
||||||
|
RSpec/BeforeAfterAll:
|
||||||
|
Description: Beware of using after(:all) as it may cause state to leak between tests.
|
||||||
|
A necessary evil in acceptance testing.
|
||||||
|
Exclude:
|
||||||
|
- spec/acceptance/**/*.rb
|
||||||
|
RSpec/HookArgument:
|
||||||
|
Description: Prefer explicit :each argument, matching existing module's style
|
||||||
|
EnforcedStyle: each
|
||||||
|
Style/BlockDelimiters:
|
||||||
|
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
|
||||||
|
be consistent then.
|
||||||
|
EnforcedStyle: braces_for_chaining
|
||||||
|
Style/ClassAndModuleChildren:
|
||||||
|
Description: Compact style reduces the required amount of indentation.
|
||||||
|
EnforcedStyle: compact
|
||||||
|
Style/EmptyElse:
|
||||||
|
Description: Enforce against empty else clauses, but allow `nil` for clarity.
|
||||||
|
EnforcedStyle: empty
|
||||||
|
Style/FormatString:
|
||||||
|
Description: Following the main puppet project's style, prefer the % format format.
|
||||||
|
EnforcedStyle: percent
|
||||||
|
Style/FormatStringToken:
|
||||||
|
Description: Following the main puppet project's style, prefer the simpler template
|
||||||
|
tokens over annotated ones.
|
||||||
|
EnforcedStyle: template
|
||||||
|
Style/Lambda:
|
||||||
|
Description: Prefer the keyword for easier discoverability.
|
||||||
|
EnforcedStyle: literal
|
||||||
|
Style/RegexpLiteral:
|
||||||
|
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
|
||||||
|
EnforcedStyle: percent_r
|
||||||
|
Style/TernaryParentheses:
|
||||||
|
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
|
||||||
|
on complex expressions for better readability, but seriously consider breaking
|
||||||
|
it up.
|
||||||
|
EnforcedStyle: require_parentheses_when_complex
|
||||||
|
Style/TrailingCommaInArguments:
|
||||||
|
Description: Prefer always trailing comma on multiline argument lists. This makes
|
||||||
|
diffs, and re-ordering nicer.
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/TrailingCommaInLiteral:
|
||||||
|
Description: Prefer always trailing comma on multiline literals. This makes diffs,
|
||||||
|
and re-ordering nicer.
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/SymbolArray:
|
||||||
|
Description: Using percent style obscures symbolic intent of array's contents.
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
RSpec/MessageSpies:
|
||||||
|
EnforcedStyle: receive
|
||||||
|
Style/Documentation:
|
||||||
|
Exclude:
|
||||||
|
- lib/puppet/parser/functions/**/*
|
||||||
|
- spec/**/*
|
||||||
|
Style/WordArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
Style/CollectionMethods:
|
||||||
|
Enabled: true
|
||||||
|
Style/MethodCalledOnDoEndBlock:
|
||||||
|
Enabled: true
|
||||||
|
Style/StringMethods:
|
||||||
|
Enabled: true
|
||||||
|
Layout/EndOfLine:
|
||||||
|
Enabled: false
|
||||||
|
Layout/IndentHeredoc:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/CyclomaticComplexity:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/ModuleLength:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/PerceivedComplexity:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/DescribeClass:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ExampleLength:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MessageExpectation:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MultipleExpectations:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/NestedGroups:
|
||||||
|
Enabled: false
|
||||||
|
Style/AsciiComments:
|
||||||
|
Enabled: false
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
Style/SymbolProc:
|
||||||
|
Enabled: false
|
53
.travis.yml
53
.travis.yml
@ -1,23 +1,44 @@
|
|||||||
---
|
---
|
||||||
language: ruby
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
dist: trusty
|
||||||
|
language: ruby
|
||||||
cache: bundler
|
cache: bundler
|
||||||
|
before_install:
|
||||||
|
- bundle -v
|
||||||
|
- rm -f Gemfile.lock
|
||||||
|
- gem update --system
|
||||||
|
- gem --version
|
||||||
|
- bundle -v
|
||||||
|
script:
|
||||||
|
- 'bundle exec rake $CHECK'
|
||||||
bundler_args: --without system_tests
|
bundler_args: --without system_tests
|
||||||
script:
|
rvm:
|
||||||
- "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
|
- 2.4.4
|
||||||
notifications:
|
env:
|
||||||
email: false
|
global:
|
||||||
|
- BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0"
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- rvm: 1.9.3
|
-
|
||||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
|
||||||
- rvm: 2.0.0
|
-
|
||||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
env: CHECK=parallel_spec
|
||||||
- rvm: 2.1.9
|
-
|
||||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
|
||||||
- rvm: 2.2.4
|
rvm: 2.1.9
|
||||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
branches:
|
||||||
- rvm: 2.3.1
|
only:
|
||||||
env: PUPPET_GEM_VERSION="~> 4.0"
|
- master
|
||||||
|
- /^v\d/
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
deploy:
|
||||||
|
provider: puppetforge
|
||||||
|
user: puppet
|
||||||
|
password:
|
||||||
|
secure: ""
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
all_branches: true
|
||||||
|
condition: "$DEPLOY_TO_FORGE = yes"
|
||||||
|
90
Gemfile
90
Gemfile
@ -1,32 +1,78 @@
|
|||||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
||||||
|
|
||||||
group :development, :unit_tests do
|
def location_for(place_or_version, fake_version = nil)
|
||||||
gem 'rspec-core', '~> 3.1.7', :require => false
|
if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
|
||||||
gem 'rspec-puppet', '~> 2.1', :require => false
|
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
|
||||||
gem 'puppetlabs_spec_helper', :require => false
|
elsif place_or_version =~ %r{\Afile:\/\/(.*)}
|
||||||
gem 'simplecov', :require => false
|
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
|
||||||
gem 'puppet_facts', :require => false
|
else
|
||||||
gem 'json', :require => false
|
[place_or_version, { require: false }]
|
||||||
gem 'metadata-json-lint', :require => false
|
end
|
||||||
gem 'puppet-lint', '< 1.1.0', :require => false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :system_tests do
|
def gem_type(place_or_version)
|
||||||
gem 'beaker-rspec', :require => false
|
if place_or_version =~ %r{\Agit[:@]}
|
||||||
gem 'serverspec', :require => false
|
:git
|
||||||
gem 'beaker-puppet_install_helper', :require => false
|
elsif !place_or_version.nil? && place_or_version.start_with?('file:')
|
||||||
|
:file
|
||||||
|
else
|
||||||
|
:gem
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
|
||||||
gem 'facter', facterversion, :require => false
|
minor_version = ruby_version_segments[0..1].join('.')
|
||||||
else
|
|
||||||
gem 'facter', :require => false
|
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::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
|
||||||
|
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]
|
||||||
end
|
end
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
puppet_version = ENV['PUPPET_GEM_VERSION']
|
||||||
gem 'puppet', puppetversion, :require => false
|
puppet_type = gem_type(puppet_version)
|
||||||
else
|
facter_version = ENV['FACTER_GEM_VERSION']
|
||||||
gem 'puppet', :require => false
|
hiera_version = ENV['HIERA_GEM_VERSION']
|
||||||
|
|
||||||
|
gems = {}
|
||||||
|
|
||||||
|
gems['puppet'] = location_for(puppet_version)
|
||||||
|
|
||||||
|
# If facter or hiera versions have been specified via the environment
|
||||||
|
# variables
|
||||||
|
|
||||||
|
gems['facter'] = location_for(facter_version) if facter_version
|
||||||
|
gems['hiera'] = location_for(hiera_version) if hiera_version
|
||||||
|
|
||||||
|
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
|
||||||
|
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
|
||||||
|
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
|
||||||
|
gems['win32-dir'] = ['<= 0.4.9', require: false]
|
||||||
|
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
|
||||||
|
gems['win32-process'] = ['<= 0.7.5', require: false]
|
||||||
|
gems['win32-security'] = ['<= 0.2.5', require: false]
|
||||||
|
gems['win32-service'] = ['0.8.8', require: false]
|
||||||
end
|
end
|
||||||
|
|
||||||
# vim:ft=ruby
|
gems.each do |gem_name, gem_params|
|
||||||
|
gem gem_name, *gem_params
|
||||||
|
end
|
||||||
|
|
||||||
|
# Evaluate Gemfile.local and ~/.gemfile if they exist
|
||||||
|
extra_gemfiles = [
|
||||||
|
"#{__FILE__}.local",
|
||||||
|
File.join(Dir.home, '.gemfile'),
|
||||||
|
]
|
||||||
|
|
||||||
|
extra_gemfiles.each do |gemfile|
|
||||||
|
if File.file?(gemfile) && File.readable?(gemfile)
|
||||||
|
eval(File.read(gemfile), binding)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# vim: syntax=ruby
|
||||||
|
84
Rakefile
84
Rakefile
@ -1,23 +1,75 @@
|
|||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppetlabs_spec_helper/rake_tasks'
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
require 'puppet-syntax/tasks/puppet-syntax'
|
||||||
|
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
|
||||||
|
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
|
||||||
|
|
||||||
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
|
def changelog_user
|
||||||
PuppetLint.configuration.fail_on_warnings = true
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
PuppetLint.configuration.send('relative')
|
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
|
||||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
puts "GitHubChangelogGenerator user:#{returnVal}"
|
||||||
PuppetLint.configuration.ignore_paths = ["vendor/**/*.pp", "spec/**/*.pp", "pkg/**/*.pp"]
|
returnVal
|
||||||
|
end
|
||||||
|
|
||||||
desc "Validate manifests, templates, and ruby files"
|
def changelog_project
|
||||||
task :validate do
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
Dir['manifests/**/*.pp'].each do |manifest|
|
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
|
||||||
sh "puppet parser validate --noop #{manifest}"
|
raise "unable to find the changelog_project in .sync.yml or the name 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']
|
||||||
|
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
|
||||||
|
puts "GitHubChangelogGenerator future_release:#{returnVal}"
|
||||||
|
returnVal
|
||||||
|
end
|
||||||
|
|
||||||
|
PuppetLint.configuration.send('disable_relative')
|
||||||
|
|
||||||
|
if Bundler.rubygems.find_name('github_changelog_generator').any?
|
||||||
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
||||||
|
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?
|
||||||
|
config.user = "#{changelog_user}"
|
||||||
|
config.project = "#{changelog_project}"
|
||||||
|
config.future_release = "#{changelog_future_release}"
|
||||||
|
config.exclude_labels = ['maintenance']
|
||||||
|
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)."
|
||||||
|
config.add_pr_wo_labels = true
|
||||||
|
config.issues = false
|
||||||
|
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
|
||||||
|
config.configure_sections = {
|
||||||
|
"Changed" => {
|
||||||
|
"prefix" => "### Changed",
|
||||||
|
"labels" => ["backwards-incompatible"],
|
||||||
|
},
|
||||||
|
"Added" => {
|
||||||
|
"prefix" => "### Added",
|
||||||
|
"labels" => ["feature", "enhancement"],
|
||||||
|
},
|
||||||
|
"Fixed" => {
|
||||||
|
"prefix" => "### Fixed",
|
||||||
|
"labels" => ["bugfix"],
|
||||||
|
},
|
||||||
|
}
|
||||||
end
|
end
|
||||||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
else
|
||||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
desc 'Generate a Changelog from GitHub'
|
||||||
end
|
task :changelog do
|
||||||
Dir['templates/**/*.erb'].each do |template|
|
raise <<EOM
|
||||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
|
||||||
|
Please manually add it to your .sync.yml for now, and run `pdk update`:
|
||||||
|
---
|
||||||
|
Gemfile:
|
||||||
|
optional:
|
||||||
|
':development':
|
||||||
|
- gem: 'github_changelog_generator'
|
||||||
|
git: 'https://github.com/skywinder/github-changelog-generator'
|
||||||
|
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
|
||||||
|
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
|
||||||
|
EOM
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
52
appveyor.yml
Normal file
52
appveyor.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
version: 1.1.x.{build}
|
||||||
|
skip_commits:
|
||||||
|
message: /^\(?doc\)?.*/
|
||||||
|
clone_depth: 10
|
||||||
|
init:
|
||||||
|
- SET
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
-
|
||||||
|
RUBY_VERSION: 24-x64
|
||||||
|
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 4.0
|
||||||
|
RUBY_VERSION: 21
|
||||||
|
CHECK: parallel_spec
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 4.0
|
||||||
|
RUBY_VERSION: 21-x64
|
||||||
|
CHECK: parallel_spec
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 5.0
|
||||||
|
RUBY_VERSION: 24
|
||||||
|
CHECK: parallel_spec
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 5.0
|
||||||
|
RUBY_VERSION: 24-x64
|
||||||
|
CHECK: parallel_spec
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
install:
|
||||||
|
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
||||||
|
- bundle install --jobs 4 --retry 2 --without system_tests
|
||||||
|
- type Gemfile.lock
|
||||||
|
build: off
|
||||||
|
test_script:
|
||||||
|
- bundle exec puppet -V
|
||||||
|
- ruby -v
|
||||||
|
- gem -v
|
||||||
|
- bundle -v
|
||||||
|
- bundle exec rake %CHECK%
|
||||||
|
notifications:
|
||||||
|
- provider: Email
|
||||||
|
to:
|
||||||
|
- nobody@nowhere.com
|
||||||
|
on_build_success: false
|
||||||
|
on_build_failure: false
|
||||||
|
on_build_status_changed: false
|
@ -7,11 +7,11 @@
|
|||||||
"source": "https://github.com/OpenConceptConsulting/puppet-nslcd",
|
"source": "https://github.com/OpenConceptConsulting/puppet-nslcd",
|
||||||
"project_page": "https://github.com/OpenConceptConsulting/puppet-nslcd",
|
"project_page": "https://github.com/OpenConceptConsulting/puppet-nslcd",
|
||||||
"issues_url": "https://github.com/OpenConceptConsulting/puppet-nslcd/issues",
|
"issues_url": "https://github.com/OpenConceptConsulting/puppet-nslcd/issues",
|
||||||
"tags": [
|
"dependencies": [
|
||||||
"nslcd",
|
{
|
||||||
"pam",
|
"name": "puppetlabs-stdlib",
|
||||||
"nss",
|
"version_range": ">= 4.0.0 < 5.0.0"
|
||||||
"ldap"
|
}
|
||||||
],
|
],
|
||||||
"operatingsystem_support": [
|
"operatingsystem_support": [
|
||||||
{
|
{
|
||||||
@ -46,10 +46,13 @@
|
|||||||
"version_requirement": ">= 3.0.0 < 5.0.0"
|
"version_requirement": ">= 3.0.0 < 5.0.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"tags": [
|
||||||
{
|
"nslcd",
|
||||||
"name": "puppetlabs-stdlib",
|
"pam",
|
||||||
"version_range": ">= 4.0.0 < 5.0.0"
|
"nss",
|
||||||
}
|
"ldap"
|
||||||
]
|
],
|
||||||
|
"pdk-version": "1.7.0",
|
||||||
|
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
|
||||||
|
"template-ref": "1.7.0-0-g57412ed"
|
||||||
}
|
}
|
||||||
|
8
spec/default_facts.yml
Normal file
8
spec/default_facts.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Use default_module_facts.yml for module specific facts.
|
||||||
|
#
|
||||||
|
# Facts specified here will override the values provided by rspec-puppet-facts.
|
||||||
|
---
|
||||||
|
concat_basedir: "/tmp"
|
||||||
|
ipaddress: "172.16.254.254"
|
||||||
|
is_pe: false
|
||||||
|
macaddress: "AA:AA:AA:AA:AA:AA"
|
@ -1,29 +1,44 @@
|
|||||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||||
|
require 'rspec-puppet-facts'
|
||||||
|
|
||||||
|
begin
|
||||||
|
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
|
||||||
|
rescue LoadError => loaderror
|
||||||
|
warn "Could not require spec_helper_local: #{loaderror.message}"
|
||||||
|
end
|
||||||
|
|
||||||
|
include RspecPuppetFacts
|
||||||
|
|
||||||
|
default_facts = {
|
||||||
|
puppetversion: Puppet.version,
|
||||||
|
facterversion: Facter.version,
|
||||||
|
}
|
||||||
|
|
||||||
|
default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
|
||||||
|
default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
|
||||||
|
|
||||||
|
if File.exist?(default_facts_path) && File.readable?(default_facts_path)
|
||||||
|
default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
|
||||||
|
default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
|
||||||
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
c.include PuppetlabsSpec::Files
|
c.default_facts = default_facts
|
||||||
|
|
||||||
c.before :each do
|
c.before :each do
|
||||||
# Ensure that we don't accidentally cache facts and environment
|
# set to strictest setting for testing
|
||||||
# between test cases.
|
# by default Puppet runs at warning level
|
||||||
Facter::Util::Loader.any_instance.stubs(:load_all)
|
Puppet.settings[:strict] = :warning
|
||||||
Facter.clear
|
|
||||||
Facter.clear_messages
|
|
||||||
|
|
||||||
# Store any environment variables away to be restored later
|
|
||||||
@old_env = {}
|
|
||||||
ENV.each_key {|k| @old_env[k] = ENV[k]}
|
|
||||||
|
|
||||||
if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
|
|
||||||
Puppet.settings[:strict_variables]=true
|
|
||||||
end
|
|
||||||
if ENV['PARSER']
|
|
||||||
Puppet.settings[:parser]=ENV['PARSER']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
c.after :each do
|
|
||||||
PuppetlabsSpec::Files.cleanup
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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)
|
||||||
|
last_module.const_get(next_module)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 'spec_overrides' from sync.yml will appear below this line
|
||||||
|
Loading…
Reference in New Issue
Block a user