From e7c549df52e456054531fde1a6403ad6429a851f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 18 Oct 2018 17:46:55 +0200 Subject: [PATCH 1/2] Remove unused variable --- manifests/params.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 253989dd..c5b4d2cf 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -317,7 +317,6 @@ $client_package = ['puppet'] } - $puppetrun_cmd = "${puppet_cmd} kick" $puppetca_cmd = "${puppet_cmd} cert" # Puppet service name From 32a5510a66f5a8f4d6335e86e2b6fb088a75b30e Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 18 Oct 2018 17:56:36 +0200 Subject: [PATCH 2/2] Add Puppet 6 support 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 --- .fixtures.yml | 9 +++++ .sync.yml | 7 +++- .travis.yml | 38 +++++++++++++++++++ manifests/params.pp | 3 +- manifests/server/config.pp | 8 +++- ...uppetserver_upgrade_2_6_0_to_2_7_2_spec.rb | 2 +- spec/classes/puppet_server_spec.rb | 14 +++++-- 7 files changed, 72 insertions(+), 9 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 0082e021..1e3d6de8 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -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' diff --git a/.sync.yml b/.sync.yml index 14d582b9..20efc90a 100644 --- a/.sync.yml +++ b/.sync.yml @@ -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 diff --git a/.travis.yml b/.travis.yml index 2fe7fb9a..a8eb24e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ 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 @@ -24,17 +26,53 @@ matrix: 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 diff --git a/manifests/params.pp b/manifests/params.pp index c5b4d2cf..260d399c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -161,6 +161,7 @@ $autosign_source = undef $puppet_cmd = "${bindir}/puppet" + $puppetserver_cmd = "${bindir}/puppetserver" $manage_packages = true @@ -317,8 +318,6 @@ $client_package = ['puppet'] } - $puppetca_cmd = "${puppet_cmd} cert" - # Puppet service name $service_name = 'puppet' diff --git a/manifests/server/config.pp b/manifests/server/config.pp index bb62d297..fa176912 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -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"], diff --git a/spec/acceptance/puppetserver_upgrade_2_6_0_to_2_7_2_spec.rb b/spec/acceptance/puppetserver_upgrade_2_6_0_to_2_7_2_spec.rb index ca42b7bf..632f1911 100644 --- a/spec/acceptance/puppetserver_upgrade_2_6_0_to_2_7_2_spec.rb +++ b/spec/acceptance/puppetserver_upgrade_2_6_0_to_2_7_2_spec.rb @@ -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') diff --git a/spec/classes/puppet_server_spec.rb b/spec/classes/puppet_server_spec.rb index 75185c14..c38be053 100644 --- a/spec/classes/puppet_server_spec.rb +++ b/spec/classes/puppet_server_spec.rb @@ -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' @@ -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' @@ -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