diff --git a/.gitattributes b/.gitattributes index 02d4646..9032a01 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ -#This file is generated by ModuleSync, do not edit. *.rb eol=lf *.erb eol=lf *.pp eol=lf *.sh eol=lf +*.epp eol=lf diff --git a/.rubocop.yml b/.rubocop.yml index 344ee17..98b298d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,6 +16,7 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" + - Vagrantfile Metrics/LineLength: Description: People have wide screens, use them. Max: 200 diff --git a/.sync.yml b/.sync.yml index d5130ce..8c5d149 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,18 +1,14 @@ --- -appveyor.yml: - environment: - PUPPET_GEM_VERSION: "~> 4.0" - matrix: - - RUBY_VERSION: 24-x64 - CHECK: "syntax lint" - - RUBY_VERSION: 24-x64 - CHECK: metadata_lint - - RUBY_VERSION: 24-x64 - CHECK: rubocop - .rubocop.yml: selected_profile: strict default_configs: &default_configs + AllCops: + DisplayCopNames: true + TargetRubyVersion: '2.1' + Include: + - "./**/*.rb" + Exclude: + - Vagrantfile Style/UnneededPercentQ: Enabled: false @@ -24,24 +20,14 @@ appveyor.yml: .travis.yml: bundler_args: "" - branches: {} - - script: "\"bundle exec rake release_checks\"" docker_sets: - - set: docker/ubuntu-18.04 - - set: docker/ubuntu-16.04 - - set: docker/ubuntu-14.04 -# - set: docker/debian-9 - - set: docker/debian-8 - - set: docker/centos-7 + - set: docker/ubuntu-18.04 + - set: docker/ubuntu-16.04 + - set: docker/ubuntu-14.04 +# - set: docker/debian-9 + - set: docker/debian-8 + - set: docker/centos-7 docker_defaults: - # values will replace @@SET@@ with the docker_sets' value - rvm: 2.5.0 - sudo: required - dist: trusty - services: docker - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=@@SET@@ - script: bundle exec rake beaker Gemfile: required: @@ -53,17 +39,6 @@ Gemfile: - mswin - mingw - x64_mingw - - gem: beaker - version: '~> 3.13' - from_env: BEAKER_VERSION - - gem: beaker-abs - from_env: BEAKER_ABS_VERSION - version: '~> 0.1' - - gem: beaker-pe - - gem: beaker-hostgenerator - from_env: BEAKER_HOSTGENERATOR_VERSION - - gem: beaker-rspec - from_env: BEAKER_RSPEC_VERSION spec/spec.opts: delete: true diff --git a/.travis.yml b/.travis.yml index 0de18ee..21996f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ script: - 'bundle exec rake $CHECK' bundler_args: rvm: - - 2.5.0 + - 2.5.1 env: global: - BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0" @@ -22,36 +22,36 @@ matrix: include: - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-18.04 - rvm: 2.5.0 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-18.04 BEAKER_TESTMODE=apply + rvm: 2.5.1 script: bundle exec rake beaker services: docker sudo: required - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 - rvm: 2.5.0 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-16.04 BEAKER_TESTMODE=apply + rvm: 2.5.1 script: bundle exec rake beaker services: docker sudo: required - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 - rvm: 2.5.0 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply + rvm: 2.5.1 script: bundle exec rake beaker services: docker sudo: required - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 - rvm: 2.5.0 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/debian-8 BEAKER_TESTMODE=apply + rvm: 2.5.1 script: bundle exec rake beaker services: docker sudo: required - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 - rvm: 2.5.0 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply + rvm: 2.5.1 script: bundle exec rake beaker services: docker sudo: required @@ -62,9 +62,6 @@ matrix: - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec rvm: 2.4.4 - - - env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec - rvm: 2.1.9 branches: only: - master diff --git a/Gemfile b/Gemfile index ee7cfca..ad54d2f 100644 --- a/Gemfile +++ b/Gemfile @@ -28,13 +28,8 @@ group :development do gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.13') - gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') - gem "beaker-pe", require: false - gem "beaker-hostgenerator" - gem "beaker-rspec" + gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] end puppet_version = ENV['PUPPET_GEM_VERSION'] 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/appveyor.yml b/appveyor.yml index 1c2ba1b..f14e28d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,8 @@ --- version: 1.1.x.{build} +branches: + only: + - master skip_commits: message: /^\(?doc\)?.*/ clone_depth: 10 @@ -38,15 +41,6 @@ environment: PUPPET_GEM_VERSION: ~> 6.0 RUBY_VERSION: 25-x64 CHECK: parallel_spec - - - RUBY_VERSION: 24-x64 - CHECK: syntax lint - - - RUBY_VERSION: 24-x64 - CHECK: metadata_lint - - - RUBY_VERSION: 24-x64 - CHECK: rubocop matrix: fast_finish: true install: diff --git a/manifests/service.pp b/manifests/service.pp index a137125..59e0321 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -4,6 +4,11 @@ assert_private("Use of private class ${name} by ${caller_module_name}") + $service_provider = $facts['service_provider'] ? { + 'debian' => 'systemd', + default => $facts['service_provider'], + } + if $cfssl::service_manage { $service_attributes = { @@ -15,7 +20,7 @@ 'intermediate_ca_id' => $cfssl::intermediate_ca_id, } - case $::service_provider { + case $service_provider { 'upstart': { file { "add-${cfssl::service_name}-conf": ensure => file, @@ -26,7 +31,7 @@ content => epp("${module_name}/service/upstart/cfssl.conf.epp", $service_attributes), } } - 'systemd': { + 'systemd', 'debian': { file { "remove-${cfssl::service_name}-conf": ensure => absent, path => "/etc/init/${cfssl::service_name}.conf", @@ -51,14 +56,14 @@ content => epp("${module_name}/service/redhat/cfssl.epp", $service_attributes), } } - default: { } + default: {} } service { $cfssl::service_name: ensure => $cfssl::service_ensure, enable => $cfssl::service_enable, name => $cfssl::service_name, - provider => $::service_provider, + provider => $service_provider, subscribe => [ Class["${module_name}::config"], File["add-${cfssl::service_name}-conf"] diff --git a/metadata.json b/metadata.json index 4ebff76..bd4fd25 100644 --- a/metadata.json +++ b/metadata.json @@ -121,7 +121,7 @@ "Public Key Infrastructure", "Certificate Managment" ], - "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 @@ 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 @@ 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