From c53df84d2d235482338393ac2d726b94fb43ba6f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 00:46:06 +0100 Subject: [PATCH 1/3] modulesync 2.5.1 --- .github/CONTRIBUTING.md | 6 +-- .github/PULL_REQUEST_TEMPLATE.md | 10 ++-- .msync.yml | 2 +- .travis.yml | 86 +++++++++----------------------- Gemfile | 17 +++---- Rakefile | 20 +++++++- spec/default_facts.yml | 13 ----- spec/spec_helper.rb | 14 ++++-- 8 files changed, 68 insertions(+), 100 deletions(-) delete mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4a519698..5d047472 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -51,19 +51,19 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development --without system_tests --without release +bundle install --path .vendor/ --without development system_tests release ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release +bundle install --path .vendor/ --with system_tests --without development release ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean +bundle install --path .vendor/ --with system_tests --without development release; bundle update; bundle clean ``` ## Syntax and style diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef25cdbf..342807bc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,13 +8,13 @@ Thank you for contributing to this project! --> #### Pull Request (PR) description #### This Pull Request (PR) fixes the following issues diff --git a/.msync.yml b/.msync.yml index 648cf244..4c6463a5 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.3.1' +modulesync_config_version: '2.5.1' diff --git a/.travis.yml b/.travis.yml index 06169e38..a9f30f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,138 +1,100 @@ --- -sudo: false -dist: trusty +dist: xenial language: ruby cache: bundler before_install: - - rm -f Gemfile.lock + - gem update --system + - gem update bundler + - bundle --version script: - 'bundle exec rake $CHECK' matrix: fast_finish: true include: - - rvm: 2.1.9 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required branches: only: - master diff --git a/Gemfile b/Gemfile index 9648d7de..6a74c57b 100644 --- a/Gemfile +++ b/Gemfile @@ -20,16 +20,15 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false + gem 'rubocop-rspec', '~> 1.15.0', :require => false gem 'mocha', '~> 1.4.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' - gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' + gem 'parallel_tests', :require => false end group :development do @@ -57,13 +56,13 @@ group :system_tests do gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' - gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false + gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '>= 1.0', :require => false @@ -77,7 +76,7 @@ else gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 279580ac..a6cf0acc 100644 --- a/Rakefile +++ b/Rakefile @@ -11,6 +11,7 @@ end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.absolute_classname_reverse = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_140chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') @@ -37,12 +38,27 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests metadata_lint, release_checks' +desc 'Run tests release_checks' task test: [ - :metadata_lint, :release_checks, ] +namespace :check do + desc 'Check for trailing whitespace' + task :trailing_whitespace do + Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| + next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} + File.foreach(filename).each_with_index do |line, index| + if line =~ %r{\s\n$} + puts "#{filename} has trailing whitespace on line #{index + 1}" + exit 1 + end + end + end + end +end +Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] + desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index 2f6698d5..00000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# use default_module_facts.yaml for module specific -# facts. -# -# Hint if using with rspec-puppet-facts ("on_supported_os.each"): -# if a same named fact exists in facterdb it will be overridden. ---- -ipaddress: "172.16.254.254" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88bca595..2f2279d2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,15 @@ require 'rspec-puppet-facts' include RspecPuppetFacts +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + if facts + facts.each do |name, value| + add_custom_fact name.to_sym, value + end + end +end + if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' @@ -22,11 +31,6 @@ end RSpec.configure do |c| - default_facts = {} - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) - c.default_facts = default_facts - # Coverage generation c.after(:suite) do RSpec::Puppet::Coverage.report! From caa53c0acdfee93ce9d4ec5da5e9d3168efcdfd3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 00:48:03 +0100 Subject: [PATCH 2/3] drop puppet 4 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index dbf0c3a4..53705035 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 5.5.8 < 7.0.0" } ], "dependencies": [ From 1c174171cb56cfcc9cf69f7a346fbf1896060299 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 22:19:44 +0100 Subject: [PATCH 3/3] puppet-lint: fix relative_classname_inclusion --- manifests/pip/bootstrap.pp | 2 +- manifests/pyvenv.pp | 2 +- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index ea3e70b7..10b3c348 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -13,7 +13,7 @@ Variant[Boolean, String] $manage_python = false, ) inherits ::python::params { if $manage_python { - include ::python + include python } else { $target_src_pip_path = $facts['os']['family'] ? { 'AIX' => '/opt/freeware/bin', diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 80142ca8..579f7b11 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -33,7 +33,7 @@ $environment = [], ) { - include ::python + include python if $ensure == 'present' { $python_version = $version ? { diff --git a/manifests/requirements.pp b/manifests/requirements.pp index d592ebfe..7d2a54a9 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -43,7 +43,7 @@ $timeout = 1800, ) { - include ::python + include python if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { fail('python::pip: root user must be used when virtualenv is system') diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 23c3a7d7..48885c56 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -51,7 +51,7 @@ $extra_pip_args = '', $virtualenv = undef ) { - include ::python + include python $python_provider = getparam(Class['python'], 'provider') $anaconda_path = getparam(Class['python'], 'anaconda_install_path')