Skip to content

Commit

Permalink
Add Puppet 6 support
Browse files Browse the repository at this point in the history
The only difference is the 6 CA generation and that we need _core repos
as fixtures because the gem doesn't include the vendored modules.

While we're at it, we also add Puppet 5 acceptance tests but because of
a lack of packages we skip:

* Debian 8 + puppet5 / puppet6
* Debian 9 + pc1
  • Loading branch information
ekohl committed Nov 18, 2018
1 parent e7c549d commit 32a5510
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
fixtures:
repositories:
apache: 'https://github.com/puppetlabs/puppetlabs-apache.git'
augeas_core:
repo: 'https://github.com/puppetlabs/puppetlabs-augeas_core'
puppet_version: '>= 6.0.0'
concat: 'https://github.com/puppetlabs/puppetlabs-concat.git'
cron_core:
repo: 'https://github.com/puppetlabs/puppetlabs-cron_core'
puppet_version: '>= 6.0.0'
extlib: 'https://github.com/voxpupuli/puppet-extlib.git'
foreman: 'https://github.com/theforeman/puppet-foreman.git'
git: 'https://github.com/theforeman/puppet-git.git'
inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git'
puppetdb: 'https://github.com/puppetlabs/puppetlabs-puppetdb.git'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
yumrepo_core:
repo: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core'
puppet_version: '>= 6.0.0'
7 changes: 5 additions & 2 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
- centos7-64
- centos6-64
- debian8-64
- debian9-64
env:
global:
- PARALLEL_TEST_PROCESSORS=8
# Some upgrade tests rely on PC1 version numbers
beaker_puppet_collection: pc1
beaker_puppet_collections:
- pc1
- puppet5
- puppet6
Rakefile:
param_docs_pattern:
- manifests/init.pp
Expand Down
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,62 @@ matrix:
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=6.0
# Acceptance tests
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=pc1 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker\,hostname=centos7-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker\,hostname=centos7-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker\,hostname=centos7-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=pc1 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker\,hostname=centos6-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker\,hostname=centos6-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker\,hostname=centos6-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=pc1 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker\,hostname=debian8-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker\,hostname=debian9-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
- rvm: 2.5.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker\,hostname=debian9-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
bundler_args: --without system_tests development
sudo: false
3 changes: 1 addition & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
$autosign_source = undef

$puppet_cmd = "${bindir}/puppet"
$puppetserver_cmd = "${bindir}/puppetserver"

$manage_packages = true

Expand Down Expand Up @@ -317,8 +318,6 @@
$client_package = ['puppet']
}

$puppetca_cmd = "${puppet_cmd} cert"

# Puppet service name
$service_name = 'puppet'

Expand Down
8 changes: 7 additions & 1 deletion manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,15 @@

# Generate a new CA and host cert if our host cert doesn't exist
if $::puppet::server::ca {
if versioncmp($::puppetversion, '6.0') > 0 {
$command = "${::puppet::puppetserver_cmd} ca setup"
} else {
$command = "${::puppet::puppet_cmd} cert --generate ${::puppet::server::certname} --allow-dns-alt-names"
}

exec {'puppet_server_config-generate_ca_cert':
creates => $::puppet::server::ssl_cert,
command => "${::puppet::puppetca_cmd} --generate ${::puppet::server::certname} --allow-dns-alt-names",
command => $command,
umask => '0022',
require => [
Concat["${::puppet::server::dir}/puppet.conf"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper_acceptance'

describe 'Scenario: 2.6.0 to 2.7.2 upgrade:' do
describe 'Scenario: 2.6.0 to 2.7.2 upgrade:', if: ENV['BEAKER_PUPPET_COLLECTION'] == 'pc1' do
before(:context) do
if check_for_package(default, 'puppetserver')
on default, puppet('resource package puppetserver ensure=purged')
Expand Down
14 changes: 11 additions & 3 deletions spec/classes/puppet_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
confdir = '/usr/local/etc/puppet'
environments_dir = '/usr/local/etc/puppet/environments'
etcdir = '/usr/local/etc/puppet'
puppetcacmd = '/usr/local/bin/puppet cert'
if facts[:puppetversion] >= '6.0'
puppetcacmd = '/usr/local/bin/puppetserver ca setup'
else
puppetcacmd = '/usr/local/bin/puppet cert --generate puppetmaster.example.com --allow-dns-alt-names'
end
puppetserver_logdir = '/var/log/puppetserver'
puppetserver_rundir = '/var/run/puppetserver'
puppetserver_vardir = '/var/puppet/server/data/puppetserver'
Expand All @@ -24,7 +28,11 @@
confdir = '/etc/puppetlabs/puppet'
environments_dir = '/etc/puppetlabs/code/environments'
etcdir = '/etc/puppetlabs/puppet'
puppetcacmd = '/opt/puppetlabs/bin/puppet cert'
if facts[:puppetversion] >= '6.0'
puppetcacmd = '/opt/puppetlabs/bin/puppetserver ca setup'
else
puppetcacmd = '/opt/puppetlabs/bin/puppet cert --generate puppetmaster.example.com --allow-dns-alt-names'
end
puppetserver_logdir = '/var/log/puppetlabs/puppetserver'
puppetserver_rundir = '/var/run/puppetlabs/puppetserver'
puppetserver_vardir = '/opt/puppetlabs/server/data/puppetserver'
Expand Down Expand Up @@ -96,7 +104,7 @@

should contain_exec('puppet_server_config-generate_ca_cert') \
.with_creates("#{ssldir}/certs/puppetmaster.example.com.pem") \
.with_command("#{puppetcacmd} --generate puppetmaster.example.com --allow-dns-alt-names") \
.with_command(puppetcacmd) \
.with_umask('0022') \
.that_requires(["Concat[#{conf_file}]", 'Exec[puppet_server_config-create_ssl_dir]'])
end
Expand Down

0 comments on commit 32a5510

Please sign in to comment.