Skip to content

Commit

Permalink
- Updated pdk templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
rehanone committed Jan 3, 2019
1 parent 5f60e3a commit 8c15daa
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ AllCops:
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
- Vagrantfile
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
Expand Down
51 changes: 13 additions & 38 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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:
Expand All @@ -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
Expand Down
25 changes: 11 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 2 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 3 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
version: 1.1.x.{build}
branches:
only:
- master
skip_commits:
message: /^\(?doc\)?.*/
clone_depth: 10
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 9 additions & 4 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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,
Expand All @@ -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",
Expand All @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
1 change: 0 additions & 1 deletion spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
28 changes: 14 additions & 14 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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|
Expand All @@ -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

Expand Down

0 comments on commit 8c15daa

Please sign in to comment.