From 286a3f9d07234ff544757d23802e11c405cc7c70 Mon Sep 17 00:00:00 2001 From: Fabien COMBERNOUS <fabien.combernous@adullact.org> Date: Mon, 31 Dec 2018 19:35:31 +0100 Subject: [PATCH] close #69 and #63 and use pdk 1.8.0 --- .gitattributes | 1 + .gitlab-ci.yml | 54 ------------------------------------------ README.md | 8 +++---- Rakefile | 1 + metadata.json | 8 +++---- spec/default_facts.yml | 1 - spec/spec_helper.rb | 28 +++++++++++----------- 7 files changed, 24 insertions(+), 77 deletions(-) diff --git a/.gitattributes b/.gitattributes index 543dd6a..9032a01 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ *.erb eol=lf *.pp eol=lf *.sh eol=lf +*.epp eol=lf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b673c2b..985239e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,15 +17,6 @@ before_script: - 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' - RUBYGEMS_VERSION: '2.7.8' - 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 @@ -42,51 +33,6 @@ parallel_spec-Ruby 2.4.4-Puppet ~> 5.5: variables: PUPPET_GEM_VERSION: '~> 5.5' -acceptance with puppet4 ubuntu1604: - stage: acceptance - variables: - BEAKER_PUPPET_COLLECTION: 'pc1' - PUPPET_INSTALL_TYPE: 'agent' - BEAKER_IS_PE: 'no' - BEAKER_debug: 'true ' - BEAKER_setfile: 'host.yml' - RBENV_VERSION: '2.4.4' - script: - - beaker-hostgenerator ubuntu1604-64{hypervisor=docker} > host.yml - - bundle exec rake beaker - tags: - - puppet-tests - -acceptance with puppet4 debian8: - stage: acceptance - variables: - BEAKER_PUPPET_COLLECTION: 'pc1' - PUPPET_INSTALL_TYPE: 'agent' - BEAKER_IS_PE: 'no' - BEAKER_debug: 'true ' - BEAKER_setfile: 'host.yml' - RBENV_VERSION: '2.4.4' - script: - - beaker-hostgenerator debian8-64{hypervisor=docker} > host.yml - - bundle exec rake beaker - tags: - - puppet-tests - -acceptance with puppet4 centos7: - stage: acceptance - variables: - BEAKER_PUPPET_COLLECTION: 'pc1' - PUPPET_INSTALL_TYPE: 'agent' - BEAKER_IS_PE: 'no' - BEAKER_debug: 'true ' - BEAKER_setfile: 'host.yml' - RBENV_VERSION: '2.4.4' - script: - - beaker-hostgenerator centos7-64{hypervisor=docker} > host.yml - - bundle exec rake beaker - tags: - - puppet-tests - acceptance with puppet5 ubuntu1604: stage: acceptance variables: diff --git a/README.md b/README.md index 4860848..2dd25a6 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ This `wordpress` module depends on `puppetlabs-stdlib` and `puppet-archive` ### Beginning with wordpress -The very basic step : +The following very basic step will install WP-CLI tool : ``` class { 'wordpress' : @@ -261,9 +261,9 @@ This module is tested with following OSes : Known bugs are listed in `CHANGELOG.md` file. -This revision is the last one supporting puppet 4.7. -Next one will increase minimal version of puppet to 4.10, at least. -Tests are done with last available release of puppet 4, 5 and 6. +Even if module should work with Puppet4, Puppet 4 is end of life since 2019-01-01. +So tests with Puppet 4 are removed. +Acceptance tests are done with last available release 5 and 6. ## Development diff --git a/Rakefile b/Rakefile index 204fb18..a6b14c5 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,7 @@ 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? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? +require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? def changelog_user return unless Rake.application.top_level_tasks.include? "changelog" diff --git a/metadata.json b/metadata.json index bf6b5af..d6b917b 100644 --- a/metadata.json +++ b/metadata.json @@ -40,10 +40,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.7.0 < 7.0.0" + "version_requirement": ">= 5.0.0 < 7.0.0" } ], - "pdk-version": "1.7.1", + "pdk-version": "1.8.0", "template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git", - "template-ref": "1.7.1-0-g810b982" -} + "template-ref": "1.8.0-0-g0d9da00" +} \ No newline at end of file diff --git a/spec/default_facts.yml b/spec/default_facts.yml index e10d991..ea1e480 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -2,7 +2,6 @@ # # Facts specified here will override the values provided by rspec-puppet-facts. --- -concat_basedir: "" 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 5e721b7..35654b3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,7 @@ 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 +require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) include RspecPuppetFacts @@ -14,15 +10,19 @@ default_facts = { 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')) +default_fact_files = [ + File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), + 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 +default_fact_files.each do |f| + next unless File.exist?(f) && File.readable?(f) && File.size?(f) -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))) + begin + default_facts.merge!(YAML.safe_load(File.read(f))) + rescue => e + RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" + end end RSpec.configure do |c| @@ -36,8 +36,8 @@ 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) + last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) + last_module.const_get(next_module, false) end end -- GitLab