From 8e5550bb4e5ff13dbf647e4fab9b4123ff81bc01 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Sun, 13 Aug 2017 13:37:31 -0400 Subject: [PATCH 1/4] Remove puppet 3 from travis and add Puppet 5 to travis --- .travis.yml | 26 +++++++++++++++++--------- metadata.json | 12 +++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index a481991..0c97d29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,23 +2,30 @@ language: ruby sudo: false bundler_args: --without development before_install: rm Gemfile.lock || true -script: bundle exec rake test +script: bundle exec rake $CHECK matrix: fast_finish: true include: - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 3.8.5" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 1.3" FUTURE_PARSER="yes" + env: PUPPET_GEM_VERSION="~> 4.5.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.5.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" + env: PUPPET_GEM_VERSION="~> 4.7.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.7.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" + env: PUPPET_GEM_VERSION="~> 4.8.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.8.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" + env: PUPPET_GEM_VERSION="~> 4.9.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.9.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" + env: PUPPET_GEM_VERSION="~> 4.10.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.10.4" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" - + env: PUPPET_GEM_VERSION="~> 4.10.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.4.1 + env: PUPPET_GEM_VERSION="~> 5.0.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test +branches: + only: + - production + - /^\d/ +notifications: + email: false deploy: provider: puppetforge user: abstractit @@ -29,5 +36,6 @@ deploy: # all_branches is required to use tags all_branches: true rvm: 2.1.9 + # Only publish the build marked with "DEPLOY_TO_FORGE" condition: - - $PUPPET_GEM_VERSION = '4.10.4' + - $DEPLOY_TO_FORGE = "yes" diff --git a/metadata.json b/metadata.json index 2970c20..f6c407d 100644 --- a/metadata.json +++ b/metadata.json @@ -12,8 +12,8 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "12.04", - "14.04" + "14.04", + "16.04" ] }, { @@ -26,7 +26,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "5", "6", "7" ] @@ -34,7 +33,6 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "5", "6", "7" ] @@ -43,14 +41,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=4.0.0 <5.0.0" + "version_requirement": ">=4.0.0 <6.0.0" } ], "dependencies": [ - { - "name": "puppetlabs/apache", - "version_requirement": ">=1.4.0 <2.0.0" - }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.6.0 <5.0.0" From 34fc2e5246cf35cd1be70e50d23947bdf5c10c1e Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Sun, 20 Aug 2017 17:59:39 -0400 Subject: [PATCH 2/4] Remove puppet3 support from classes and tests --- manifests/agent.pp | 9 +- manifests/defaults.pp | 54 ++-- manifests/init.pp | 8 +- manifests/install.pp | 21 +- manifests/install/deps.pp | 36 --- manifests/master.pp | 14 +- manifests/master/install.pp | 24 +- manifests/master/install/deps.pp | 21 -- manifests/master/passenger.pp | 88 ------- manifests/repo.pp | 12 +- manifests/repo/apt.pp | 48 +--- manifests/repo/yum.pp | 74 +----- spec/classes/puppet_agent_spec.rb | 6 +- spec/classes/puppet_config_spec.rb | 10 +- spec/classes/puppet_facts_spec.rb | 35 +-- spec/classes/puppet_install_deps_spec.rb | 63 ----- spec/classes/puppet_install_spec.rb | 41 +-- spec/classes/puppet_master_config_spec.rb | 15 +- spec/classes/puppet_master_hiera_spec.rb | 79 ++---- .../puppet_master_install_deps_spec.rb | 57 ----- spec/classes/puppet_master_install_spec.rb | 214 +++------------- spec/classes/puppet_master_passenger_spec.rb | 236 ------------------ spec/classes/puppet_master_server_spec.rb | 12 +- spec/classes/puppet_master_spec.rb | 22 +- spec/classes/puppet_profile_agent_spec.rb | 9 +- spec/classes/puppet_profile_master_spec.rb | 13 +- spec/classes/puppet_profile_puppetdb_spec.rb | 21 +- spec/classes/puppet_repo_apt_spec.rb | 70 +----- spec/classes/puppet_repo_spec.rb | 12 +- spec/classes/puppet_repo_yum_spec.rb | 196 ++------------- spec/classes/puppet_spec.rb | 15 +- spec/defines/fact_spec.rb | 9 +- spec/defines/setting_spec.rb | 4 - 33 files changed, 185 insertions(+), 1363 deletions(-) delete mode 100644 manifests/install/deps.pp delete mode 100644 manifests/master/install/deps.pp delete mode 100644 manifests/master/passenger.pp delete mode 100644 spec/classes/puppet_install_deps_spec.rb delete mode 100644 spec/classes/puppet_master_install_deps_spec.rb delete mode 100644 spec/classes/puppet_master_passenger_spec.rb diff --git a/manifests/agent.pp b/manifests/agent.pp index bb20938..caedea9 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -4,13 +4,8 @@ include ::puppet include ::puppet::defaults - $sysconfigdir = $::puppet::defaults::sysconfigdir - - if ( versioncmp($::puppetversion, '4.0.0') >= 0 ) { - $bin_dir = '/opt/puppetlabs/bin' - } else { - $bin_dir = '/usr/bin' - } + $sysconfigdir = $::puppet::defaults::sysconfigdir + $bin_dir = '/opt/puppetlabs/bin' if $::puppet::enabled { #we want puppet enabled diff --git a/manifests/defaults.pp b/manifests/defaults.pp index 02410cf..d7ad2cf 100644 --- a/manifests/defaults.pp +++ b/manifests/defaults.pp @@ -15,54 +15,32 @@ class puppet::defaults { case $::osfamily { 'Debian' : { - $puppetmaster_pkg = 'puppetmaster' - $sysconfigdir = '/etc/default' + $sysconfigdir = '/etc/default' } 'RedHat' : { - $puppetmaster_pkg = 'puppet-server' - $sysconfigdir = '/etc/sysconfig' + $sysconfigdir = '/etc/sysconfig' } default : { fail("Class['puppet::defaults']: Unsupported osfamily: ${::osfamily}") } } - # if we are currently running puppet v4 or upgrading to it - if versioncmp($::puppetversion, '4.0.0') >= 0 or $puppet::allinone { - $server_type = 'puppetserver' - $confdir = '/etc/puppetlabs/puppet' - $codedir = '/etc/puppetlabs/code' - $basemodulepath = "${codedir}/modules:${confdir}/modules" - $hiera_backends = { - 'yaml' => { - 'datadir' => '/etc/puppetlabs/code/hieradata/%{environment}' - } + $server_type = 'puppetserver' + $confdir = '/etc/puppetlabs/puppet' + $codedir = '/etc/puppetlabs/code' + $basemodulepath = "${codedir}/modules:${confdir}/modules" + $hiera_backends = { + 'yaml' => { + 'datadir' => '/etc/puppetlabs/code/hieradata/%{environment}' } - $facterbasepath = '/opt/puppetlabs/facter' - $reports_dir = '/opt/puppetlabs/server/data/reports' - $terminus_package = 'puppetdb-termini' - $puppetdb_etcdir = '/etc/puppetlabs/puppetdb' - $puppetdb_test_url = '/pdb/meta/v1/version' - $gem_provider = 'puppetserver_gem' - $puppet_group = 'root' - } else { - $server_type = 'passenger' - $confdir = '/etc/puppet' - $codedir = '/etc/puppet' - $basemodulepath = "${confdir}/modules:/usr/share/puppet/modules" - $hiera_backends = { - 'yaml' => { - 'datadir' => '/etc/puppet/hieradata/%{environment}' - } - } - $facterbasepath = '/etc/facter' - $reports_dir = '/var/lib/puppet/reports' - $terminus_package = 'puppetdb-terminus' - $puppetdb_etcdir = '/etc/puppetdb' - $puppetdb_test_url = '/v3/version' - $gem_provider = 'gem' - $puppet_group = 'puppet' } + $facterbasepath = '/opt/puppetlabs/facter' + $reports_dir = '/opt/puppetlabs/server/data/reports' + $terminus_package = 'puppetdb-termini' + $puppetdb_etcdir = '/etc/puppetlabs/puppetdb' + $puppetdb_test_url = '/pdb/meta/v1/version' + $gem_provider = 'puppetserver_gem' + $puppet_group = 'root' $puppetdb_confdir = "${puppetdb_etcdir}/conf.d" $puppetdb_ssl_dir = "${puppetdb_etcdir}/ssl" $autosign_file = "${confdir}/autosign.conf" diff --git a/manifests/init.pp b/manifests/init.pp index 7ed0aef..6519cb7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,7 +5,7 @@ # @puppet when declaring the puppet class # include puppet # -# @param allinone [Boolean] Default: false +# @param allinone [Boolean] Default: true # Whether to use the new collections # @param agent_cron_hour [String] Default: '*' # The hour to run the agent cron. Valid values are `0-23` @@ -23,7 +23,7 @@ # Port to use as the CA server for all agents. # @param cfacter [Boolean] Default: false # Whether or not to use cfacter instead of facter. -# @param collection [String] Default: undef +# @param collection [String] Default: PC1 # Declares the collection repository to use. # @param custom_facts [Hash] Default: undef # A hash of custom facts to setup using the ::puppet::facts define. @@ -100,14 +100,14 @@ # https://tickets.puppetlabs.com/browse/PUP-1035) class puppet ( - $allinone = false, + $allinone = true, $agent_cron_hour = '*', $agent_cron_min = 'two_times_an_hour', $agent_version = 'installed', $ca_server = undef, $ca_port = undef, $cfacter = false, - $collection = undef, + $collection = 'PC1', $custom_facts = undef, $devel_repo = false, $enabled = true, diff --git a/manifests/install.pp b/manifests/install.pp index 7c02aee..ab5e88b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -4,24 +4,11 @@ include ::puppet include ::puppet::defaults - $allinone = $::puppet::allinone - $agent_version = $::puppet::agent_version - $puppet_version = $::puppet::puppet_version + $agent_version = $::puppet::agent_version - if ($allinone) { - $agent_package = 'puppet-agent' - $package_ensure = $agent_version - } else { - $agent_package = 'puppet' - $package_ensure = $puppet_version - } - - include ::puppet::install::deps - - package { $agent_package: - ensure => $package_ensure, - require => Class['::puppet::install::deps'], - notify => Class['::puppet::agent'], + package { 'puppet-agent': + ensure => $agent_version, + notify => Class['::puppet::agent'], } } diff --git a/manifests/install/deps.pp b/manifests/install/deps.pp deleted file mode 100644 index 9474394..0000000 --- a/manifests/install/deps.pp +++ /dev/null @@ -1,36 +0,0 @@ -# Class puppet::install::deps - -class puppet::install::deps { - include ::puppet - include ::puppet::defaults - - if ($::puppet::allinone == false) { - # only install these allinone is false - - $facter_version = $::puppet::facter_version - $hiera_version = $::puppet::hiera_version - # $puppet_version = $::puppet::puppet_version - - # case $::osfamily { - # 'Debian': { - # package { 'puppet-common': - # ensure => $puppet_version, - # require => [ - # Package['hiera'], - # Package['facter'], - # ] - # } - # } - # } - - package { 'hiera': - ensure => $hiera_version, - } - - package { 'facter': - ensure => $facter_version, - } - - } - -} \ No newline at end of file diff --git a/manifests/master.pp b/manifests/master.pp index b59504d..3ece40f 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -207,19 +207,7 @@ include ::puppet::master::install include ::puppet::master::config include ::puppet::master::hiera - - case $server_type { - 'puppetserver': { - include ::puppet::master::server - # Class['puppet::master::hiera'] ~> - # Class['puppet::master::server'] - } - default: { - include ::puppet::master::passenger - # Class['puppet::master::hiera'] ~> - # Class['puppet::master::passenger'] - } - } + include ::puppet::master::server Class['puppet::master::install'] -> Class['puppet::master::config'] -> diff --git a/manifests/master/install.pp b/manifests/master/install.pp index 02dfbed..862c631 100644 --- a/manifests/master/install.pp +++ b/manifests/master/install.pp @@ -5,36 +5,16 @@ include ::puppet::defaults include ::puppet::master - $allinone = $::puppet::allinone - $server_type = $::puppet::master::server_type $hiera_eyaml_version = $::puppet::master::hiera_eyaml_version $manage_hiera_eyaml_package = $::puppet::master::manage_hiera_eyaml_package $deep_merge_version = $::puppet::master::deep_merge_version $manage_deep_merge_package = $::puppet::master::manage_deep_merge_package - $puppet_version = $::puppet::master::puppet_version - $puppetmaster_pkg = $::puppet::defaults::puppetmaster_pkg $server_version = $::puppet::master::server_version $gem_provider = $::puppet::defaults::gem_provider - if ($allinone == true) { - $server_package = 'puppetserver' - $package_ensure = $server_version - } else { - if ($server_type == 'puppetserver') { - $server_package = 'puppetserver' - $package_ensure = $server_version - } else { - $server_package = $puppetmaster_pkg - $package_ensure = $puppet_version - } - } - - include ::puppet::master::install::deps - - package { $server_package: - ensure => $package_ensure, + package { 'puppetserver': + ensure => $server_version, require => [ - Class[puppet::master::install::deps], Class[puppet::install], ], } diff --git a/manifests/master/install/deps.pp b/manifests/master/install/deps.pp deleted file mode 100644 index 07c0b31..0000000 --- a/manifests/master/install/deps.pp +++ /dev/null @@ -1,21 +0,0 @@ -# Class puppet::master::install::deps - -class puppet::master::install::deps { - include ::puppet::master - include ::puppet - - $puppet_version = $::puppet::master::puppet_version - - if ($::puppet::allinone == false) { - case $::osfamily { - 'Debian': { - package { 'puppetmaster-common': - ensure => $puppet_version - } - } - default: { - # no deps for non debian - } - } - } -} diff --git a/manifests/master/passenger.pp b/manifests/master/passenger.pp deleted file mode 100644 index 03aac37..0000000 --- a/manifests/master/passenger.pp +++ /dev/null @@ -1,88 +0,0 @@ -# Class puppet::master::passenger - -class puppet::master::passenger { - include ::puppet::master - $passenger_max_pool_size = $::puppet::master::passenger_max_pool_size - $passenger_max_requests = $::puppet::master::passenger_max_requests - $passenger_pool_idle_time = $::puppet::master::passenger_pool_idle_time - $passenger_stat_throttle_rate = $::puppet::master::passenger_stat_throttle_rate - $puppet_fqdn = $::puppet::master::puppet_fqdn - $puppet_version = $::puppet::master::puppet_version - if ($::operatingsystem == 'Debian') { - $vhost_cfg = 'puppetmaster' - } else { - $vhost_cfg = 'puppetmaster.conf' - } - - if ( versioncmp($::puppetversion, '4.0.0') < 0 ) { - # only set this up on puppetversion < 4 - service { 'puppetmaster': - ensure => stopped, - enable => false, - require => Class['puppet::master::install'], - } - - file { "/etc/apache2/sites-enabled/${vhost_cfg}": - ensure => absent, - require => Package['puppetmaster-passenger'] - } - - file { "/etc/apache2/sites-available/${vhost_cfg}": - ensure => absent, - require => Package['puppetmaster-passenger'] - } - - package { 'puppetmaster-passenger': - ensure => $puppet_version, - require => [ - Class['puppet::master::install'], - Service['puppetmaster']] - } - - include ::apache - - # passenger settings - class { '::apache::mod::passenger': - passenger_high_performance => 'On', - passenger_max_pool_size => $passenger_max_pool_size, - passenger_pool_idle_time => $passenger_pool_idle_time, - passenger_stat_throttle_rate => $passenger_stat_throttle_rate, - passenger_max_requests => $passenger_max_requests - } - - apache::vhost { $puppet_fqdn: - docroot => '/usr/share/puppet/rack/puppetmasterd/public/', - docroot_owner => 'root', - docroot_group => 'root', - passenger_app_root => '/usr/share/puppet/rack/puppetmasterd', - port => '8140', - ssl => true, - ssl_crl_check => 'chain', - ssl_cert => "/var/lib/puppet/ssl/certs/${puppet_fqdn}.pem", - ssl_key => "/var/lib/puppet/ssl/private_keys/${puppet_fqdn}.pem", - ssl_chain => '/var/lib/puppet/ssl/certs/ca.pem', - ssl_ca => '/var/lib/puppet/ssl/certs/ca.pem', - ssl_crl => '/var/lib/puppet/ssl/ca/ca_crl.pem', - ssl_certs_dir => '/var/lib/puppet/ssl/certs', - ssl_verify_client => 'optional', - ssl_verify_depth => '1', - ssl_options => [ - '+StdEnvVars', - '+ExportCertData'], - rack_base_uris => ['/'], - directories => [{ - path => '/usr/share/puppet/rack/puppetmasterd/', - options => 'None' - } - ], - request_headers => [ - 'unset X-Forwarded-For', - 'set X-SSL-Subject %{SSL_CLIENT_S_DN}e', - 'set X-Client-DN %{SSL_CLIENT_S_DN}e', - 'set X-Client-Verify %{SSL_CLIENT_VERIFY}e', - ], - subscribe => Class['puppet::master::install'], - require => Package['puppetmaster-passenger'], - } - } -} diff --git a/manifests/repo.pp b/manifests/repo.pp index 8dd6ce5..568d4f9 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -18,15 +18,9 @@ } } 'package': { - if $::puppet::collection != undef { - $lc_collection_name = downcase($::puppet::collection) - package { "puppetlabs-release-${lc_collection_name}": - ensure => latest, - } - } else { - package { 'puppetlabs-release': - ensure => latest, - } + $lc_collection_name = downcase($::puppet::collection) + package { "puppetlabs-release-${lc_collection_name}": + ensure => latest, } } } diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 38be342..8535c4d 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -6,46 +6,20 @@ #we only do anything if we're managing repos. include ::apt if $::puppet::enable_repo { - $source_ensure = 'present' + $repo_ensure = 'present' } else { - $source_ensure = 'absent' - } - if $::puppet::enable_devel_repo { - $devel_ensure = 'present' - } else { - $devel_ensure = 'absent' + $repo_ensure = 'absent' } - if $::puppet::collection != undef { - $lc_collection_name = downcase($::puppet::collection) - apt::source { "puppetlabs-${lc_collection_name}": - ensure => 'present', - location => 'http://apt.puppetlabs.com', - repos => $::puppet::collection, - key => { - 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', - }, - } - } else { - apt::source { 'puppetlabs': - ensure => $source_ensure, - location => 'http://apt.puppetlabs.com', - repos => 'main dependencies', - key => { - 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', - }, - } - apt::source { 'puppetlabs_devel': - ensure => $devel_ensure, - location => 'http://apt.puppetlabs.com', - repos => 'devel', - key => { - 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', - 'server' => 'pgp.mit.edu', - }, - } + $lc_collection_name = downcase($::puppet::collection) + apt::source { "puppetlabs-${lc_collection_name}": + ensure => 'present', + location => 'http://apt.puppetlabs.com', + repos => $::puppet::collection, + key => { + 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', + 'server' => 'pgp.mit.edu', + }, } }#manage_repos diff --git a/manifests/repo/yum.pp b/manifests/repo/yum.pp index 10184bb..e070daa 100644 --- a/manifests/repo/yum.pp +++ b/manifests/repo/yum.pp @@ -4,73 +4,13 @@ include ::puppet if $::puppet::manage_repos { - if $::puppet::enable_repo { - $source_enable = '1' - } else { - $source_enable = '0' - } - - if $::puppet::enable_devel_repo { - $devel_enabled = '1' - } else { - $devel_enabled = '0' - } - if ($::puppet::collection != undef ) { - $lc_collection_name = downcase($puppet::collection) - yumrepo { "puppetlabs-${lc_collection_name}": - descr => "Puppet Labs Collection ${::puppet::collection} EL ${::operatingsystemmajrelease} - ${::architecture}", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/${::puppet::collection}/${::architecture}", - enabled => '1', - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } - } else { - - yumrepo { 'puppetlabs-products': - descr => "Puppet Labs Products EL ${::operatingsystemmajrelease} - ${::architecture}", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/products/${::architecture}", - enabled => '1', - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } - yumrepo { 'puppetlabs-products-source': - descr => "Puppet Labs Products EL ${::operatingsystemmajrelease} - ${::architecture} - Source", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/products/SRPMS", - enabled => $source_enable, - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } - - yumrepo { 'puppetlabs-deps': - descr => "Puppet Labs Dependencies EL ${::operatingsystemmajrelease} - ${::architecture}", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/dependencies/${::architecture}", - enabled => '1', - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } - yumrepo { 'puppetlabs-deps-source': - descr => "Puppet Labs Dependencies EL ${::operatingsystemmajrelease} - ${::architecture} - Source", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/dependencies/SRPMS", - enabled => $source_enable, - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - failovermethod => 'priority' - } - - yumrepo { 'puppetlabs-devel': - descr => "Puppet Labs Devel EL ${::operatingsystemmajrelease} - ${::architecture}", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/devel/${::architecture}", - enabled => $devel_enabled, - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } - yumrepo { 'puppetlabs-devel-source': - descr => "Puppet Labs Devel EL ${::operatingsystemmajrelease} - ${::architecture} - Source", - baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/devel/SRPMS", - enabled => $source_enable, - gpgcheck => '1', - gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - } + $lc_collection_name = downcase($puppet::collection) + yumrepo { "puppetlabs-${lc_collection_name}": + descr => "Puppet Labs Collection ${::puppet::collection} EL ${::operatingsystemmajrelease} - ${::architecture}", + baseurl => "http://yum.puppetlabs.com/el/${::operatingsystemmajrelease}/${::puppet::collection}/${::architecture}", + enabled => '1', + gpgcheck => '1', + gpgkey => 'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', } } # manage_repos diff --git a/spec/classes/puppet_agent_spec.rb b/spec/classes/puppet_agent_spec.rb index 74c79d1..e65c08d 100644 --- a/spec/classes/puppet_agent_spec.rb +++ b/spec/classes/puppet_agent_spec.rb @@ -30,11 +30,7 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - bin_dir = '/opt/puppetlabs/bin' - else - bin_dir = '/usr/bin' - end + bin_dir = '/opt/puppetlabs/bin' case facts[:osfamily] when 'Debian' sysconfigdir = '/etc/default' diff --git a/spec/classes/puppet_config_spec.rb b/spec/classes/puppet_config_spec.rb index 37cb28b..acad49d 100644 --- a/spec/classes/puppet_config_spec.rb +++ b/spec/classes/puppet_config_spec.rb @@ -30,12 +30,8 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - else - confdir = '/etc/puppet' - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' case facts[:osfamily] when 'Debian' sysconfigdir = '/etc/default' @@ -161,7 +157,7 @@ }) end end # ca_server is not set - + context 'when ::puppet::ca_port is set' do let(:pre_condition){"class{'::puppet': ca_port => '8141'}"} it "should set ca_port to 8141" do diff --git a/spec/classes/puppet_facts_spec.rb b/spec/classes/puppet_facts_spec.rb index 581cbac..36aea7d 100644 --- a/spec/classes/puppet_facts_spec.rb +++ b/spec/classes/puppet_facts_spec.rb @@ -81,33 +81,16 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - facterbasepath = '/opt/puppetlabs/facter' - else - facterbasepath = '/etc/facter' - end + facterbasepath = '/opt/puppetlabs/facter' context 'when fed no parameters' do - if Puppet.version.to_f >= 4.0 - # setting environemnt doesn't work in puppet 4 - it "should lay down #{facterbasepath}/facts.d/local.yaml" do - should contain_file("#{facterbasepath}/facts.d/local.yaml").with_content( - /facts for my.client.cert/ - ).with_content( - /FQDN my.fq.hostname/ - )#.with_content( - # /Environment production/ - #) - end - else - it "should lay down #{facterbasepath}/facts.d/local.yaml" do - should contain_file("#{facterbasepath}/facts.d/local.yaml").with_content( - /facts for my.client.cert/ - ).with_content( - /FQDN my.fq.hostname/ - ).with_content( - /Environment production/ - ) - end + it "should lay down #{facterbasepath}/facts.d/local.yaml" do + should contain_file("#{facterbasepath}/facts.d/local.yaml").with_content( + /facts for my.client.cert/ + ).with_content( + /FQDN my.fq.hostname/ + )#.with_content( + # /Environment production/ + #) end end#no params context 'when the custom_facts parameter is properly set' do diff --git a/spec/classes/puppet_install_deps_spec.rb b/spec/classes/puppet_install_deps_spec.rb deleted file mode 100644 index 684e4e2..0000000 --- a/spec/classes/puppet_install_deps_spec.rb +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'pry' - -describe 'puppet::install::deps', :type => :class do - on_supported_os({ - :hardwaremodels => ['x86_64'], - :supported_os => [ - { - "operatingsystem" => "Ubuntu", - "operatingsystemrelease" => [ - "14.04" - ] - }, - { - "operatingsystem" => "CentOS", - "operatingsystemrelease" => [ - "7" - ] - } - ], - }).each do |os, facts| - context "When on an #{os} system" do - let(:facts) do - facts.merge({ - :concat_basedir => '/tmp', - :puppetversion => Puppet.version - }) - end - it { is_expected.to compile.with_all_deps } - - context 'when ::puppet::allinone is not defined' do - let(:pre_condition) {"class{'puppet': allinone => false}"} - - ['facter','hiera'].each do |pkg| - context 'and when fed no parameters' do - it "should install the #{pkg} package"do - should contain_package(pkg).with({ - :ensure => 'installed' - }) - end#specific package - end#no params - end#package iterator - - context 'and when the ::puppet::hiera_version param has a custom value' do - let(:pre_condition) {"class{'puppet': hiera_version => 'latest'}"} - it 'should install the specified version if the hiera packages' do - should contain_package('hiera').with({:ensure => 'latest'}) - end - end#hiera_version - - context 'and when the ::puppet::facter_version param has a custom value' do - let(:pre_condition) {"class{'puppet': facter_version => 'latest'}"} - it 'should install the specified version if the facter packages' do - should contain_package('facter').with({:ensure => 'latest'}) - end - end#facter_version - - end#end ::puppet::allinone undefined - - end - end -end diff --git a/spec/classes/puppet_install_spec.rb b/spec/classes/puppet_install_spec.rb index 572b7dc..ee29791 100644 --- a/spec/classes/puppet_install_spec.rb +++ b/spec/classes/puppet_install_spec.rb @@ -30,42 +30,19 @@ end it { is_expected.to compile.with_all_deps } - it 'should contain the ::puppet::install::deps class' do - should contain_class('puppet::install::deps') - end - context 'when ::puppet has default paramaters' do - context 'when ::puppet::allinone is true' do - let(:pre_condition) {"class{'puppet': allinone => true}"} - it 'should install puppet-agent' do - contain_package('puppet-agent').that_requires("Class['::puppet::install::deps]") - end - end#end allinone true - context 'when ::puppet::allinone false' do - let(:pre_condition) {"class{'puppet': allinone => false}"} - it 'should install puppet' do - contain_package('puppet').that_requires("Class['::puppet::install::deps]") - end - end#end allinone false + it 'should install puppet-agent' do + contain_package('puppet-agent') + end end#end default paramaters context 'when specific version is required' do - context 'when ::puppet::allinone is true' do - let(:pre_condition) {"class{'::puppet': allinone => true, agent_version=>'BOGON' }"} - it 'should install puppet-agent' do - contain_package('puppet-agent').with({ - :ensure=>"BOGON", - }).that_requires("Class['::puppet::install::deps]") - end - end# allinone true - context 'when ::puppet::allinone is false' do - let(:pre_condition) {"class{'::puppet': allinone => false, puppet_version=>'BOGON' }"} - it 'should install puppet' do - contain_package('puppet').with({ - :ensure=>"BOGON", - }).that_requires("Class['::puppet::install::deps]").that_notifies('class[Puppet::Agent]') - end - end# allinone false + let(:pre_condition) {"class{'::puppet': agent_version=>'BOGON' }"} + it 'should install puppet-agent' do + contain_package('puppet-agent').with({ + :ensure=>"BOGON", + }) + end end end diff --git a/spec/classes/puppet_master_config_spec.rb b/spec/classes/puppet_master_config_spec.rb index c952656..38b3d5b 100644 --- a/spec/classes/puppet_master_config_spec.rb +++ b/spec/classes/puppet_master_config_spec.rb @@ -29,17 +29,10 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - basemodulepath = "#{codedir}/modules:#{confdir}/modules" - reports_dir = "/opt/puppetlabs/server/data/reports" - else - confdir = '/etc/puppet' - codedir = '/etc/puppet' - basemodulepath = "#{confdir}/modules:/usr/share/puppet/modules" - reports_dir = "/var/lib/puppet/reports" - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' + basemodulepath = "#{codedir}/modules:#{confdir}/modules" + reports_dir = "/opt/puppetlabs/server/data/reports" context "when fed no parameters" do it "should properly set the environmentpath in #{confdir}/puppet.conf" do should contain_ini_setting('Puppet environmentpath').with({ diff --git a/spec/classes/puppet_master_hiera_spec.rb b/spec/classes/puppet_master_hiera_spec.rb index 9d2eef7..035d163 100644 --- a/spec/classes/puppet_master_hiera_spec.rb +++ b/spec/classes/puppet_master_hiera_spec.rb @@ -44,60 +44,31 @@ end context 'when fed no parameters' do - if Puppet.version =~ /^4\./ - it "should lay down #{codedir}/hiera.yaml" do - should contain_file("#{codedir}/hiera.yaml").with({ - 'ensure' =>'file', - 'owner' =>'root', - 'group' =>'root', - 'mode' =>'0644' - }).with_content( - /:backends:/ - ).with_content( - / - yaml/ - ).with_content( - /:hierarchy:/ - ).with_content( - / - \"node\/\%\{\:\:clientcert\}\"/ - ).with_content( - / - \"env\/\%\{\:\:environment\}\"/ - ).with_content( - / - \"global\"/ - ).with_content( - /:yaml:/ - ).with_content( - / :datadir: \"\/etc\/puppetlabs\/code\/hieradata\/%\{environment\}\"/ - ).without_content( - / :merge_behavior: "/ - ) - end - else - it "should lay down #{codedir}/hiera.yaml" do - should contain_file("#{codedir}/hiera.yaml").with({ - 'ensure' =>'file', - 'owner' =>'root', - 'group' =>'root', - 'mode' =>'0644' - }).with_content( - /:backends:/ - ).with_content( - / - yaml/ - ).with_content( - /:hierarchy:/ - ).with_content( - / - \"node\/\%\{\:\:clientcert\}\"/ - ).with_content( - / - \"env\/\%\{\:\:environment\}\"/ - ).with_content( - / - \"global\"/ - ).with_content( - /:yaml:/ - ).with_content( - / :datadir: \"\/etc\/puppet\/hieradata\/%\{environment\}\"/ - ).without_content( - / :merge_behavior: "/ - ) - end + it "should lay down #{codedir}/hiera.yaml" do + should contain_file("#{codedir}/hiera.yaml").with({ + 'ensure' =>'file', + 'owner' =>'root', + 'group' =>'root', + 'mode' =>'0644' + }).with_content( + /:backends:/ + ).with_content( + / - yaml/ + ).with_content( + /:hierarchy:/ + ).with_content( + / - \"node\/\%\{\:\:clientcert\}\"/ + ).with_content( + / - \"env\/\%\{\:\:environment\}\"/ + ).with_content( + / - \"global\"/ + ).with_content( + /:yaml:/ + ).with_content( + / :datadir: \"\/etc\/puppetlabs\/code\/hieradata\/%\{environment\}\"/ + ).without_content( + / :merge_behavior: "/ + ) end end#no params diff --git a/spec/classes/puppet_master_install_deps_spec.rb b/spec/classes/puppet_master_install_deps_spec.rb deleted file mode 100644 index 8d73e0a..0000000 --- a/spec/classes/puppet_master_install_deps_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'pry' - -describe 'puppet::master::install::deps', :type => :class do - - on_supported_os({ - :hardwaremodels => ['x86_64'], - :supported_os => [ - { - "operatingsystem" => "Ubuntu", - "operatingsystemrelease" => [ - "14.04" - ] - }, - { - "operatingsystem" => "CentOS", - "operatingsystemrelease" => [ - "7" - ] - } - ], - }).each do |os, facts| - context "When on an #{os} system" do - let(:facts) do - facts.merge({ - :concat_basedir => '/tmp', - :puppetversion => Puppet.version - }) - end - it { is_expected.to compile.with_all_deps } - context 'when ::puppet::allinone is not defined' do - case facts[:osfamily] - when 'Debian' - context 'when osfamily == Debian' do - let(:pre_condition) {"class{'::puppet': allinone => false}"} - it 'should install the puppetmaster-common package' do - should contain_package('puppetmaster-common').with( - 'ensure'=>'installed', - ) - end#end no params - - context 'when the ::puppet::master::puppet_version param has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': puppet_version=>'latest' }"} - it 'should install the specified version of the puppetmaster-common package' do - # skip 'This does not work as is' - should contain_package('puppetmaster-common').with( - 'ensure' => 'latest', - ) - end - end - end - end - end#end ::puppet::allinone not defined - end - end -end diff --git a/spec/classes/puppet_master_install_spec.rb b/spec/classes/puppet_master_install_spec.rb index 81d87f1..f828ca2 100644 --- a/spec/classes/puppet_master_install_spec.rb +++ b/spec/classes/puppet_master_install_spec.rb @@ -32,65 +32,23 @@ end it { is_expected.to compile.with_all_deps } - it 'should contain the ::puppet::master::install::deps class' do - should contain_class('puppet::master::install::deps') - end - context 'when fed no parameters' do - context 'when ::puppet::allinone is true' do - let(:pre_condition){"class{'::puppet': allinone => true}"} - it "should install the puppetserver package" do - should contain_package('puppetserver').with({ - :ensure=>"installed", - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end# allinone true - context 'when ::puppet::allinone is false' do - let(:pre_condition){"class{'::puppet': allinone => false}"} - let(:pre_condition){"class{'::puppet::master': server_type=>'passenger' }"} - case facts[:osfamily] - when 'Debian' - it 'should install the puppetmaster package' do - should contain_package('puppetmaster').with({ - :ensure=>"installed", - }).that_requires('Class[puppet::master::install::deps]') - end - when 'RedHat' - it 'should install the puppet-server package' do - should contain_package('puppet-server').with({ - :ensure=>"installed", - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end - end# allinone false + it "should install the puppetserver package" do + should contain_package('puppetserver').with({ + :ensure=>"installed", + }).that_requires( + 'Class[puppet::install]' + ) + end context 'when ::puppet::master::manage_hiera_eyaml_package is true' do let(:pre_condition){"class{'::puppet::master': manage_hiera_eyaml_package=>true }"} - if Puppet.version.to_f >= 4.0 - context 'when puppetversion >= 4' do - it 'should install the hiera-eyaml package with the puppetserver_gem provider' do - should contain_package('hiera-eyaml').with({ - :ensure => 'installed', - :provider => 'puppetserver_gem' - }) - end - end - else - context 'when puppetversion < 4' do - it 'should install the hiera-eyaml package with the gem provider' do - should contain_package('hiera-eyaml').with({ - :ensure => 'installed', - :provider => 'gem' - }) - end + context 'when puppetversion >= 4' do + it 'should install the hiera-eyaml package with the puppetserver_gem provider' do + should contain_package('hiera-eyaml').with({ + :ensure => 'installed', + :provider => 'puppetserver_gem' + }) end end end#manage_hiera_eyaml_package true @@ -104,24 +62,11 @@ context 'when ::puppet::master::manage_deep_merge_package is true' do let(:pre_condition){"class{'::puppet::master': manage_deep_merge_package=>true }"} - if Puppet.version.to_f >= 4.0 - context 'when puppetversion >= 4' do - it 'should install the deep_merge package with the puppetserver_gem provider' do - should contain_package('deep_merge').with({ - :ensure => 'installed', - :provider => 'puppetserver_gem' - }) - end - end - else - context 'when puppetversion < 4' do - it 'should install the deep_merge package with the gem provider' do - should contain_package('deep_merge').with({ - :ensure => 'installed', - :provider => 'gem' - }) - end - end + it 'should install the deep_merge package with the puppetserver_gem provider' do + should contain_package('deep_merge').with({ + :ensure => 'installed', + :provider => 'puppetserver_gem' + }) end end#manage_deep_merge_package true @@ -134,120 +79,33 @@ end#no params context 'when the a specific version of puppetserver is required' do - context 'when ::puppet::allinone is true' do - let(:pre_condition){"class{'::puppet': allinone => true}"} - let(:pre_condition){"class{'::puppet::master': server_version => 'latest', server_type => 'puppetserver' }"} - it "should install the specified version of the puppetserver package" do - should contain_package('puppetserver').with({ - 'ensure' => 'latest', - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end# allinone true - context 'when ::puppet::allinone is false' do - if Puppet.version.to_f < 4.0 - # this fails in puppet 4 - let(:pre_condition){"class{'::puppet': allinone => false}"} - let(:pre_condition){"class{'::puppet::master': puppet_version => '3.8.4', server_type => 'passenger' }"} - case facts[:osfamily] - when 'Debian' - it 'should install the puppetmaster package' do - should contain_package('puppetmaster').with({ - 'ensure' => '3.8.4', - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - when 'RedHat' - it 'should install the puppet-server package' do - should contain_package('puppet-server').with({ - 'ensure' => '3.8.4', - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end - end - end# allinone false - context 'when ::puppet::allinone is false and server_type is puppetserver' do - let(:pre_condition){"class{'::puppet': allinone => false}"} - let(:pre_condition){"class{'::puppet::master': server_type => 'puppetserver' }"} - it 'should install the puppetserver package' do - should contain_package('puppetserver').that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end# allinone false server_type = puppetserver - context 'when ::puppet::allinone is false server_version is set and server_type is puppetserver' do - if Puppet.version.to_f < 4.0 - # this fails in puppet 4 - let(:pre_condition){"class{'::puppet': allinone => false}"} - let(:pre_condition){"class{'::puppet::master': server_type => 'puppetserver', server_version => '2.1.2' }"} - it 'should install the specified version of the puppetserver package' do - should contain_package('puppetserver').with({ - 'ensure' => '2.1.2', - }).that_requires( - 'Class[puppet::master::install::deps]' - ).that_requires( - 'Class[puppet::install]' - ) - end - end - end# allinone false server_type = puppetserver + let(:pre_condition){"class{'::puppet::master': server_version => 'latest', server_type => 'puppetserver' }"} + it "should install the specified version of the puppetserver package" do + should contain_package('puppetserver').with({ + 'ensure' => 'latest', + }).that_requires( + 'Class[puppet::install]' + ) + end end # specific version of puppetserver context 'when the hiera_eyaml_version param has a non-standard value' do let(:pre_condition) {"class{'::puppet::master': manage_hiera_eyaml_package=>true, hiera_eyaml_version=>'BOGON' }"} - if Puppet.version.to_f >= 4.0 - context 'when puppetversion >= 4' do - it 'should install the specified version of the hiera-eyaml package with the puppetserver_gem provider' do - should contain_package('hiera-eyaml').with({ - :ensure => 'BOGON', - :provider => 'puppetserver_gem' - }) - end - end - else - context 'when puppetversion < 4' do - it 'should install the specified version of the hiera-eyaml package with the gem provider' do - should contain_package('hiera-eyaml').with({ - :ensure => 'BOGON', - :provider => 'gem' - }) - end - end + it 'should install the specified version of the hiera-eyaml package with the puppetserver_gem provider' do + should contain_package('hiera-eyaml').with({ + :ensure => 'BOGON', + :provider => 'puppetserver_gem' + }) end end # hiera_eyaml_version defined context 'when the deep_merge_version param has a non-standard value' do let(:pre_condition) {"class{'::puppet::master': manage_deep_merge_package=>true, deep_merge_version=>'BOGON' }"} - if Puppet.version.to_f >= 4.0 - context 'when puppetversion >= 4' do - it 'should install the specified version of the deep_merge package with the puppetserver_gem provider' do - should contain_package('deep_merge').with({ - :ensure => 'BOGON', - :provider => 'puppetserver_gem' - }) - end - end - else - context 'when puppetversion < 4' do - it 'should install the specified version of the deep_merge package with the gem provider' do - should contain_package('deep_merge').with({ - :ensure => 'BOGON', - :provider => 'gem' - }) - end - end + it 'should install the specified version of the deep_merge package with the puppetserver_gem provider' do + should contain_package('deep_merge').with({ + :ensure => 'BOGON', + :provider => 'puppetserver_gem' + }) end end # deep_merge_version defined diff --git a/spec/classes/puppet_master_passenger_spec.rb b/spec/classes/puppet_master_passenger_spec.rb deleted file mode 100644 index 7356c13..0000000 --- a/spec/classes/puppet_master_passenger_spec.rb +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env rspec -require 'spec_helper' -require 'pry' - -describe 'puppet::master::passenger', :type => :class do - # context 'input validation' do - # ['passenger_max_pool_size','passenger_max_requests','passenger_pool_idle_time','passenger_stat_throttle_rate','puppet_fqdn','puppet_version'].each do |strings| - # context "when the #{strings} parameter is not a string" do - # let(:params) {{strings => false }} - # it 'should fail' do - # skip 'This does not work as is' - # expect { - # should compile - # }.to raise_error(Puppet::Error)#, /false is not a string./) - # end - # end - # end#strings - # end#input validation - - on_supported_os({ - :hardwaremodels => ['x86_64'], - :supported_os => [ - { - "operatingsystem" => "Ubuntu", - "operatingsystemrelease" => [ - "12.04", - "14.04" - ] - }, - { - "operatingsystem" => "Debian", - "operatingsystemrelease" => [ - "7" - ] - } - ] - }).each do |os, facts| - context "When on an #{os} system" do - let(:facts) do - facts.merge({ - :concat_basedir => '/tmp', - :fqdn => 'constructorfleet.vogon.gal', - :domain => 'vogon.gal', - :puppetversion => Puppet.version - }) - end - case facts[:operatingsystem] - when 'Debian' - vhost_cfg = 'puppetmaster' - when 'Ubuntu' - vhost_cfg = 'puppetmaster.conf' - end - it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f < 4.0 - context 'when puppet_version < 4' do - context 'when fed no parameters' do - - it 'should install the puppetmaster-passenger package' do - should contain_package('puppetmaster-passenger').with({ - :ensure=>"installed", - }).that_requires("Class[puppet::master::install]").that_requires("Service[puppetmaster]") - end - - it 'should disable the puppetmaster service' do - should contain_service('puppetmaster').with({ - :ensure=>"stopped", - :enable=>false, - }).that_requires('Class[puppet::master::install]') - end - - it "should remove the default #{vhost_cfg} vhost file from /etc/apache2/sites-available" do - should contain_file("/etc/apache2/sites-available/#{vhost_cfg}").with({ - :ensure => 'absent' - }).that_requires('Package[puppetmaster-passenger]') - end - - it "should remove the default #{vhost_cfg} vhost file from /etc/apache2/sites-enabled" do - should contain_file("/etc/apache2/sites-enabled/#{vhost_cfg}").with({ - :ensure => 'absent' - }).that_requires('Package[puppetmaster-passenger]') - end - - it 'should properly instantiate the apache class' do - should contain_class('apache') - end - it 'should properly instantiate the apache::mod::passenger class' do - should contain_class('apache::mod::passenger').with({ - :passenger_high_performance=>"On", - :passenger_max_pool_size=>"12", - :passenger_pool_idle_time=>"1500", - :passenger_stat_throttle_rate=>"120", - :passenger_max_requests=>"0", - :passenger_conf_file=>"passenger.conf" - }) - end - - it 'should set up the apache vhost' do - if ENV['FUTURE_PARSER'] == 'yes' - should contain_apache__vhost('constructorfleet.vogon.gal').with({ - :docroot=>"/usr/share/puppet/rack/puppetmasterd/public/", - :docroot_owner=>"root", - :docroot_group=>"root", - :passenger_app_root=>"/usr/share/puppet/rack/puppetmasterd", - :port=>"8140", - :ssl=>true, - :ssl_crl_check=>'chain', - :ssl_cert=>"/var/lib/puppet/ssl/certs/constructorfleet.vogon.gal.pem", - :ssl_key=>"/var/lib/puppet/ssl/private_keys/constructorfleet.vogon.gal.pem", - :ssl_chain=>"/var/lib/puppet/ssl/certs/ca.pem", - :ssl_ca=>"/var/lib/puppet/ssl/certs/ca.pem", - :ssl_crl=>"/var/lib/puppet/ssl/ca/ca_crl.pem", - :ssl_certs_dir=>"/var/lib/puppet/ssl/certs", - :ssl_verify_client=>"optional", - :ssl_verify_depth=>"1", - :ssl_options=>["+StdEnvVars", "+ExportCertData"], - :rack_base_uris=>["/"], - :directories=>[{"path"=>"/usr/share/puppet/rack/puppetmasterd/", "options"=>"None"}], - :request_headers=>["unset X-Forwarded-For", "set X-SSL-Subject %{SSL_CLIENT_S_DN}e", "set X-Client-DN %{SSL_CLIENT_S_DN}e", "set X-Client-Verify %{SSL_CLIENT_VERIFY}e"] - }).that_subscribes_to('Class[puppet::master::install]').that_requires('Package[puppetmaster-passenger]') - else - should contain_apache__vhost('constructorfleet.vogon.gal').with({ - :docroot=>"/usr/share/puppet/rack/puppetmasterd/public/", - :docroot_owner=>"root", - :docroot_group=>"root", - :passenger_app_root=>"/usr/share/puppet/rack/puppetmasterd", - :port=>"8140", - :ssl=>true, - :ssl_crl_check=>'chain', - :ssl_cert=>"/var/lib/puppet/ssl/certs/constructorfleet.vogon.gal.pem", - :ssl_key=>"/var/lib/puppet/ssl/private_keys/constructorfleet.vogon.gal.pem", - :ssl_chain=>"/var/lib/puppet/ssl/certs/ca.pem", - :ssl_ca=>"/var/lib/puppet/ssl/certs/ca.pem", - :ssl_crl=>"/var/lib/puppet/ssl/ca/ca_crl.pem", - :ssl_certs_dir=>"/var/lib/puppet/ssl/certs", - :ssl_verify_client=>"optional", - :ssl_verify_depth=>"1", - :ssl_options=>["+StdEnvVars", "+ExportCertData"], - :rack_base_uris=>["/"], - :directories=>[["path","/usr/share/puppet/rack/puppetmasterd/"], ["options","None"]], - :request_headers=>["unset X-Forwarded-For", "set X-SSL-Subject %{SSL_CLIENT_S_DN}e", "set X-Client-DN %{SSL_CLIENT_S_DN}e", "set X-Client-Verify %{SSL_CLIENT_VERIFY}e"] - }).that_subscribes_to('Class[puppet::master::install]').that_requires('Package[puppetmaster-passenger]') - end - end#end apache vhost - end#no params - - context 'when the puppet_version param has a non-standard value' do - let(:pre_condition){"class{'::puppet::master': puppet_version => 'BOGON'}"} - it 'should install the specified version of the puppetmaster-passenger package' do - # skip 'This does not work as is' - should contain_package('puppetmaster-passenger').with({ - :ensure=>"BOGON", - }).that_requires("Class[puppet::master::install]").that_requires("Service[puppetmaster]") - end - end - - context 'when passenger_max_pool_size has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': passenger_max_pool_size => 'BOGON'}"} - it 'should properly instantiate the apache::mod::passenger class' do - should contain_class('apache::mod::passenger').with({ - :passenger_high_performance=>"On", - :passenger_max_pool_size=>"BOGON", - :passenger_pool_idle_time=>"1500", - :passenger_stat_throttle_rate=>"120", - :passenger_max_requests=>"0", - :passenger_conf_file=>"passenger.conf" - }) - end - end#end passenger_max_pool_size - - context 'when passenger_max_requests has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': passenger_max_requests => 'BOGON'}"} - it 'should properly instantiate the apache::mod::passenger class' do - should contain_class('apache::mod::passenger').with({ - :passenger_high_performance=>"On", - :passenger_max_pool_size=>"12", - :passenger_pool_idle_time=>"1500", - :passenger_stat_throttle_rate=>"120", - :passenger_max_requests=>"BOGON", - :passenger_conf_file=>"passenger.conf" - }) - end - end#end passenger_max_requests - - context 'when passenger_pool_idle_time has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': passenger_pool_idle_time => 'BOGON'}"} - it 'should properly instantiate the apache::mod::passenger class' do - should contain_class('apache::mod::passenger').with({ - :passenger_high_performance=>"On", - :passenger_max_pool_size=>"12", - :passenger_pool_idle_time=>"BOGON", - :passenger_stat_throttle_rate=>"120", - :passenger_max_requests=>"0", - :passenger_conf_file=>"passenger.conf" - }) - end - end#end passenger_pool_idle_time - - context 'when passenger_stat_throttle_rate has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': passenger_stat_throttle_rate => 'BOGON'}"} - it 'should properly instantiate the apache::mod::passenger class' do - should contain_class('apache::mod::passenger').with({ - :passenger_high_performance=>"On", - :passenger_max_pool_size=>"12", - :passenger_pool_idle_time=>"1500", - :passenger_stat_throttle_rate=>"BOGON", - :passenger_max_requests=>"0", - :passenger_conf_file=>"passenger.conf" - }) - end - end#end passenger_stat_throttle_rate - - context 'when puppet_fqdn has a non-standard value' do - let(:pre_condition) {"class{'::puppet::master': puppet_fqdn => 'BOGON'}"} - it 'should properly instantiate the apache::vhost defined type' do - should contain_apache__vhost('BOGON').with({ - :name=>"BOGON", - :ssl_cert=>"/var/lib/puppet/ssl/certs/BOGON.pem", - :ssl_key=>"/var/lib/puppet/ssl/private_keys/BOGON.pem", - }) - end - end#end puppet_fqdn - end#end puppet < 4 - end# puppetversion - end#each OS -# context '[Debian - unspecific]' do -# let(:facts) {{'fqdn' => 'constructorfleet.vogon.gal','lsbdistcodename' => 'squeeze', 'osfamily' => osfam, 'operatingsystemrelease' => '6.06','concat_basedir' => '/tmp'}} -# it 'should not add the SSLCARevocationCheck chain to the apache vhost config' do -# skip 'This does not work as is' -# should contain_apache__vhost('constructorfleet.vogon.gal').without({ -# :contents=>/SSLCARevocationCheck chain/ -# }) -# end -# end - end # on_supported_os -end - diff --git a/spec/classes/puppet_master_server_spec.rb b/spec/classes/puppet_master_server_spec.rb index 969ec33..b97f305 100644 --- a/spec/classes/puppet_master_server_spec.rb +++ b/spec/classes/puppet_master_server_spec.rb @@ -29,15 +29,9 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - basemodulepath = "#{codedir}/modules:/#{confdir}/modules" - else - confdir = '/etc/puppet' - codedir = '/etc/puppet' - basemodulepath = "#{confdir}/modules:/usr/share/puppet/modules" - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' + basemodulepath = "#{codedir}/modules:/#{confdir}/modules" case facts[:osfamily] when 'Debian' sysconfigdir = '/etc/default' diff --git a/spec/classes/puppet_master_spec.rb b/spec/classes/puppet_master_spec.rb index e8333cc..4b87b47 100644 --- a/spec/classes/puppet_master_spec.rb +++ b/spec/classes/puppet_master_spec.rb @@ -93,26 +93,8 @@ should contain_class('puppet::master::hiera') end - if Puppet.version.to_f >= 4.0 - context 'when puppetversion >= 4' do - it 'should properly instantiate the puppet::master::server class' do - should contain_class('puppet::master::server') - end - end - else - context 'when puppetversion < 4' do - context 'when server_type is set to puppetserver' do - let(:params) {{'server_type' => 'puppetserver'}} - it 'should properly instantiate the puppet::master::server class' do - should contain_class('puppet::master::server') - end - end - context 'when server_type is set to passenger' do - it 'should properly instantiate the puppet::master::passenger class' do - should contain_class('puppet::master::passenger') - end - end - end + it 'should properly instantiate the puppet::master::server class' do + should contain_class('puppet::master::server') end end#no params diff --git a/spec/classes/puppet_profile_agent_spec.rb b/spec/classes/puppet_profile_agent_spec.rb index ee025d8..0d35691 100644 --- a/spec/classes/puppet_profile_agent_spec.rb +++ b/spec/classes/puppet_profile_agent_spec.rb @@ -28,13 +28,8 @@ }) end # it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - else - confdir = '/etc/puppet' - codedir = '/etc/puppet' - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' context 'when fed no parameters' do it { should create_class('puppet') } end#no params diff --git a/spec/classes/puppet_profile_master_spec.rb b/spec/classes/puppet_profile_master_spec.rb index 1bc850f..179c70e 100644 --- a/spec/classes/puppet_profile_master_spec.rb +++ b/spec/classes/puppet_profile_master_spec.rb @@ -29,13 +29,8 @@ }) end # it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - else - confdir = '/etc/puppet' - codedir = '/etc/puppet' - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' context 'when fed no parameters' do it { should create_class('puppet::master') } it 'should contain class ::puppetdb::globals' do @@ -52,7 +47,7 @@ :listen_port => '8080', :ssl_listen_port => '8081', :disable_ssl => false, - :manage_dbserver => true, + :manage_dbserver => true, :listen_address => '127.0.0.1', :ssl_listen_address => '0.0.0.0', :node_ttl => '0s', @@ -70,7 +65,7 @@ :listen_port => '8080', :ssl_listen_port => '8081', :disable_ssl => false, - :manage_dbserver => false, + :manage_dbserver => false, :listen_address => '127.0.0.1', :ssl_listen_address => '0.0.0.0', :node_ttl => '0s', diff --git a/spec/classes/puppet_profile_puppetdb_spec.rb b/spec/classes/puppet_profile_puppetdb_spec.rb index fdcd2d6..7aec1bb 100644 --- a/spec/classes/puppet_profile_puppetdb_spec.rb +++ b/spec/classes/puppet_profile_puppetdb_spec.rb @@ -30,21 +30,12 @@ }) end # it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - confdir = '/etc/puppetlabs/puppet' - codedir = '/etc/puppetlabs/code' - terminus_package = 'puppetdb-termini' - puppetdb_confdir = '/etc/puppetlabs/puppetdb/conf.d' - puppetdb_ssldir = '/etc/puppetlabs/puppetdb/ssl' - puppetdb_test_url = '/pdb/meta/v1/version' - else - confdir = '/etc/puppet' - codedir = '/etc/puppet' - terminus_package = 'puppetdb-terminus' - puppetdb_confdir = '/etc/puppetdb/conf.d' - puppetdb_ssldir = '/etc/puppetdb/ssl' - puppetdb_test_url = '/v3/version' - end + confdir = '/etc/puppetlabs/puppet' + codedir = '/etc/puppetlabs/code' + terminus_package = 'puppetdb-termini' + puppetdb_confdir = '/etc/puppetlabs/puppetdb/conf.d' + puppetdb_ssldir = '/etc/puppetlabs/puppetdb/ssl' + puppetdb_test_url = '/pdb/meta/v1/version' context 'when fed no parameters' do # it 'should include class ::postgresql::server::contrib' do diff --git a/spec/classes/puppet_repo_apt_spec.rb b/spec/classes/puppet_repo_apt_spec.rb index fc1aa87..009978e 100644 --- a/spec/classes/puppet_repo_apt_spec.rb +++ b/spec/classes/puppet_repo_apt_spec.rb @@ -31,81 +31,25 @@ end it { is_expected.to compile.with_all_deps } context 'when ::puppet has default parameters' do - let(:pre_condition){"class{'::puppet':}"} - it 'should add the puppetlabs apt source' do - should contain_apt__source('puppetlabs').with({ - :name=>"puppetlabs", - :ensure=>"present", - :location=>"http://apt.puppetlabs.com", - :repos=>"main dependencies", - :key=>[["id", "6F6B15509CF8E59E6E469F327F438280EF8D349F"], ["server", "pgp.mit.edu"]], - :comment=>"puppetlabs", - }) - end - it 'should remove the puppetlabs_devel apt source' do - should contain_apt__source('puppetlabs_devel').with({ - :name=>"puppetlabs_devel", - :ensure=>"absent", - :location=>"http://apt.puppetlabs.com", - :repos=>"devel", - :key=>[["id", "6F6B15509CF8E59E6E469F327F438280EF8D349F"], ["server", "pgp.mit.edu"]], - :comment=>"puppetlabs_devel", - }) - end - end#no params - - context 'when ::puppet::collection is defined' do - let(:pre_condition){"class{'::puppet': collection => 'BOGON'}"} + let(:pre_condition){"class{'::puppet': collection => 'PC1'}"} it 'should contain the puppetlabs ::puppet::collection repository' do - should contain_apt__source('puppetlabs-bogon').with({ - :name=>"puppetlabs-bogon", + should contain_apt__source('puppetlabs-pc1').with({ + :name=>"puppetlabs-pc1", :ensure=>"present", :location=>"http://apt.puppetlabs.com", - :repos=>"BOGON", + :repos=>"PC1", :key=>[["id", "6F6B15509CF8E59E6E469F327F438280EF8D349F"], ["server", "pgp.mit.edu"]], }) - should_not contain_apt__source('puppetlabs') - should_not contain_apt__source('puppetlabs_devel') end - end + end#no params context 'when ::puppet::manage_repos is false' do - let(:pre_condition){"class{'::puppet': manage_repos => false}"} + let(:pre_condition){"class{'::puppet': manage_repos => false, collection => 'PC1'}"} it 'should not lay down any apt sources' do - should_not contain_apt__source('puppetlabs') - should_not contain_apt__source('puppetlabs_devel') + should_not contain_apt__source('puppetlabs-pc1') end end - context 'when ::puppet::manage_repos is true' do - context 'when ::puppet::enable_devel_repo is false' do - let(:pre_condition){"class{'::puppet': enable_devel_repo => false}"} - it 'should remove the puppetlabs_devel apt source' do - should contain_apt__source('puppetlabs_devel').with({ - :name=>"puppetlabs_devel", - :ensure=>"absent", - :location=>"http://apt.puppetlabs.com", - :repos=>"devel", - :key=>[["id", "6F6B15509CF8E59E6E469F327F438280EF8D349F"], ["server", "pgp.mit.edu"]], - :comment=>"puppetlabs_devel", - }) - end - end - - context 'when ::puppet::enable_devel_repo is true' do - let(:pre_condition){"class{'::puppet': enable_devel_repo => true}"} - it 'should add the puppetlabs_devel apt source' do - should contain_apt__source('puppetlabs_devel').with({ - :name=>"puppetlabs_devel", - :ensure=>"present", - :location=>"http://apt.puppetlabs.com", - :repos=>"devel", - :key=>[["id", "6F6B15509CF8E59E6E469F327F438280EF8D349F"], ["server", "pgp.mit.edu"]], - :comment=>"puppetlabs_devel", - }) - end - end#end devel_repo - end end end end diff --git a/spec/classes/puppet_repo_spec.rb b/spec/classes/puppet_repo_spec.rb index f02276a..3d65040 100644 --- a/spec/classes/puppet_repo_spec.rb +++ b/spec/classes/puppet_repo_spec.rb @@ -30,8 +30,7 @@ it { is_expected.to compile.with_all_deps } context 'when ::puppet::manage_repo_method is set to files' do let(:pre_condition){"class{'::puppet': manage_repo_method => 'files', collection => 'PC1'}"} - it 'should not install puppetlabs-release packages' do - should_not contain_package('puppetlabs-release') + it 'should not install puppetlabs-release-pc1 packages' do should_not contain_package('puppetlabs-release-pc1') end case facts[:osfamily] @@ -48,26 +47,17 @@ context 'when ::puppet::manage_repo_method is set to packages' do let(:pre_condition){"class{'::puppet': manage_repo_method => 'package' }"} - context "when ::puppet::collection is not defined" do - it "should install the puppetlabs-release package" do - should contain_package('puppetlabs-release') - end#puppetlabs-release - end context "when ::puppet::collection is set to PC1" do let(:pre_condition){"class{'::puppet': manage_repo_method => 'package', collection => 'PC1'}"} it 'should contain the puppetlabs-release-pc1 package' do should contain_package('puppetlabs-release-pc1') end - it 'should not contain the puppetlabs-release package' do - should_not contain_package('puppetlabs-release') - end end end #manage_repo_method packages context 'when ::puppet::manage_repos is set to false' do let(:pre_condition){"class{'::puppet': manage_repos => false, collection => 'PC1' }"} it 'should not install puppetlabs-release packages' do - should_not contain_package('puppetlabs-release') should_not contain_package('puppetlabs-release-pc1') end it 'should not contain repo classes' do diff --git a/spec/classes/puppet_repo_yum_spec.rb b/spec/classes/puppet_repo_yum_spec.rb index a44e109..20b52d8 100644 --- a/spec/classes/puppet_repo_yum_spec.rb +++ b/spec/classes/puppet_repo_yum_spec.rb @@ -3,7 +3,7 @@ require 'pry' describe 'puppet::repo::yum', :type => :class do - + on_supported_os({ :hardwaremodels => ['x86_64'], :supported_os => [ @@ -34,208 +34,44 @@ end it { is_expected.to compile.with_all_deps } context 'when ::puppet has default parameters' do - let(:pre_condition){"class{'::puppet':}"} - it 'should add the puppetlabs-products yum repo' do + let(:pre_condition){"class{'::puppet': collection => 'PC1'}"} + it 'should contain the puppetlabs ::puppet::collection repository' do case facts['operatingsystemmajrelease'] when '5' - should contain_yumrepo('puppetlabs-products').with({ - 'descr'=>'Puppet Labs Products EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/products/x86_64', + should contain_yumrepo('puppetlabs-pc1').with({ + 'descr'=>'Puppet Labs Collection PC1 EL 5 - x86_64', + 'baseurl'=>'http://yum.puppetlabs.com/el/5/BOGON/x86_64', 'enabled'=>'1', 'gpgcheck'=>'1', 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', }) when '6' - should contain_yumrepo('puppetlabs-products').with({ - 'descr'=>'Puppet Labs Products EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/products/x86_64', + should contain_yumrepo('puppetlabs-pc1').with({ + 'descr'=>'Puppet Labs Collection PC1 EL 6 - x86_64', + 'baseurl'=>'http://yum.puppetlabs.com/el/6/BOGON/x86_64', 'enabled'=>'1', 'gpgcheck'=>'1', 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', }) when '7' - should contain_yumrepo('puppetlabs-products').with({ - 'descr'=>'Puppet Labs Products EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/products/x86_64', + should contain_yumrepo('puppetlabs-pc1').with({ + 'descr'=>'Puppet Labs Collection PC1 EL 7 - x86_64', + 'baseurl'=>'http://yum.puppetlabs.com/el/7/BOGON/x86_64', 'enabled'=>'1', 'gpgcheck'=>'1', 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', }) - end - end - it 'should add the puppetlabs-deps yum repo' do - case facts['operatingsystemmajrelease'] - when '5' - should contain_yumrepo('puppetlabs-deps').with({ - 'descr'=>'Puppet Labs Dependencies EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/dependencies/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '6' - should contain_yumrepo('puppetlabs-deps').with({ - 'descr'=>'Puppet Labs Dependencies EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/dependencies/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '7' - should contain_yumrepo('puppetlabs-deps').with({ - 'descr'=>'Puppet Labs Dependencies EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/dependencies/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - end - end - it 'should disable the puppetlabs-devel yum repo' do - case facts['operatingsystemmajrelease'] - when '5' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '6' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '7' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - end + end#end case end end#no params + context 'when ::puppet::manage_repos is false' do - let(:pre_condition){"class{'::puppet': manage_repos => false}"} + let(:pre_condition){"class{'::puppet': manage_repos => false, collection => 'PC1'}"} it 'should not lay down any yum repos' do - should_not contain_yumrepo('puppetlabs-products') - should_not contain_yumrepo('puppetlabs-deps') - should_not contain_yumrepo('puppetlabs-devel') + should_not contain_yumrepo('puppetlabs-pc1') end end - context 'when ::puppet::manage_repos is true' do - context 'when ::puppet::collection is defined' do - let(:pre_condition){"class{'::puppet': collection => 'BOGON'"} - it 'should contain the puppetlabs ::puppet::collection repository' do - case facts['operatingsystemmajrelease'] - when '5' - should contain_yumrepo('puppetlabs-bogon').with({ - 'descr'=>'Puppet Labs Collection BOGON EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/BOGON/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - should_not contain_yumrepo('puppetlabs-products') - should_not contain_yumrepo('puppetlabs-deps') - should_not contain_yumrepo('puppetlabs-devel') - when '6' - should contain_yumrepo('puppetlabs-bogon').with({ - 'descr'=>'Puppet Labs Collection BOGON EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/BOGON/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - should_not contain_yumrepo('puppetlabs-products') - should_not contain_yumrepo('puppetlabs-deps') - should_not contain_yumrepo('puppetlabs-devel') - when '7' - should contain_yumrepo('puppetlabs-bogon').with({ - 'descr'=>'Puppet Labs Collection BOGON EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/BOGON/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - should_not contain_yumrepo('puppetlabs-products') - should_not contain_yumrepo('puppetlabs-deps') - should_not contain_yumrepo('puppetlabs-devel') - end#end case - end - end #end puppet::collection - - context 'when ::puppet::enable_devel_repo is false' do - let(:pre_condition){"class{'::puppet': enable_devel_repo => false}"} - it 'should disable the puppetlabs-devel yum repo' do - case facts['operatingsystemmajrelease'] - when '5' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '6' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '7' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/devel/x86_64', - 'enabled'=>'0', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - end#end case - end - end#end enable_devel_repo false - - context 'when ::puppet::enable_devel_repo is true' do - let(:pre_condition){"class{'::puppet': enable_devel_repo => true}"} - it 'should enable the puppetlabs_devel yum repo' do - case facts['operatingsystemmajrelease'] - when '5' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 5 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/5/devel/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '6' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 6 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/6/devel/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - when '7' - should contain_yumrepo('puppetlabs-devel').with({ - 'descr'=>'Puppet Labs Devel EL 7 - x86_64', - 'baseurl'=>'http://yum.puppetlabs.com/el/7/devel/x86_64', - 'enabled'=>'1', - 'gpgcheck'=>'1', - 'gpgkey'=>'https://yum.puppetlabs.com/RPM-GPG-KEY-puppet', - }) - end - end - end#end devel_repo - - end end end end diff --git a/spec/classes/puppet_spec.rb b/spec/classes/puppet_spec.rb index 7383db6..bce7648 100644 --- a/spec/classes/puppet_spec.rb +++ b/spec/classes/puppet_spec.rb @@ -45,7 +45,7 @@ let(:params) {{ hashes => 'this is a string'}} it 'should fail' do # skip 'This does not work as is' - expect { + expect { catalogue }.to raise_error(Puppet::Error) end @@ -57,7 +57,7 @@ let(:params) {{regex => 'BOGON'}} it 'should fail' do # skip 'This does not work as is' - expect { + expect { catalogue }.to raise_error(Puppet::Error) end @@ -69,7 +69,7 @@ let(:params) {{strings => false }} it 'should fail' do # skip 'This does not work as is' - expect { + expect { catalogue }.to raise_error(Puppet::Error) end @@ -104,13 +104,8 @@ }) end it { is_expected.to compile.with_all_deps } - if Puppet.version.to_f >= 4.0 - facterbasepath = '/opt/puppetlabs/facter' - facterbasepath_group = 'root' - else - facterbasepath = '/etc/facter' - facterbasepath_group = 'puppet' - end + facterbasepath = '/opt/puppetlabs/facter' + facterbasepath_group = 'root' context 'when fed no parameters' do it 'should instantiate the puppet::repo class with the default params' do should contain_class('puppet::repo') diff --git a/spec/defines/fact_spec.rb b/spec/defines/fact_spec.rb index d7831a3..46074d4 100644 --- a/spec/defines/fact_spec.rb +++ b/spec/defines/fact_spec.rb @@ -77,13 +77,8 @@ }) end - if Puppet.version.to_f >= 4.0 - facterbasepath = '/opt/puppetlabs/facter' - facterbasepath_group = 'root' - else - facterbasepath = '/etc/facter' - facterbasepath_group = 'puppet' - end + facterbasepath = '/opt/puppetlabs/facter' + facterbasepath_group = 'root' context 'when fed no parameters' do let (:title) { 'my_fact'} let (:params) {{'value' => 'my_val'}} diff --git a/spec/defines/setting_spec.rb b/spec/defines/setting_spec.rb index 7e6cc6f..b432247 100644 --- a/spec/defines/setting_spec.rb +++ b/spec/defines/setting_spec.rb @@ -29,11 +29,7 @@ }) end - if Puppet.version.to_f >= 4.0 confdir = '/etc/puppetlabs/puppet' - else - confdir = '/etc/puppet' - end context 'when called with base options' do let (:title) { 'my_setting'} From cb634042abda57820d81af845cd7ce1c3c8a4e9d Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Tue, 22 Aug 2017 16:36:01 -0400 Subject: [PATCH 3/4] Update versions of required modules PuppetDB: 6.0.1 better support for Puppet 4+ min puppet version is now 4.7.0 PostgreSQL: 5.1.0 --- .fixtures.yml | 9 +++------ .travis.yml | 2 -- metadata.json | 8 ++++---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index e6d6ab6..9b47037 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,14 +1,11 @@ fixtures: forge_modules: - apache: - repo: "puppetlabs/apache" - ref: "1.4.1" concat: repo: "puppetlabs/concat" ref: "1.2.2" stdlib: repo: "puppetlabs/stdlib" - ref: "4.6.0" + ref: "4.19.0" apt: repo: "puppetlabs/apt" ref: "2.1.0" @@ -17,10 +14,10 @@ fixtures: ref: "1.2.0" postgresql: repo: "puppetlabs/postgresql" - ref: "4.6.0" + ref: "5.1.0" puppetdb: repo: "puppetlabs/puppetdb" - ref: "5.0.0" + ref: "6.0.1" firewall: repo: "puppetlabs/firewall" ref: "1.5.0" diff --git a/.travis.yml b/.travis.yml index 0c97d29..b000944 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ script: bundle exec rake $CHECK matrix: fast_finish: true include: - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.5.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.7.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test - rvm: 2.1.9 diff --git a/metadata.json b/metadata.json index f6c407d..7f3ba02 100644 --- a/metadata.json +++ b/metadata.json @@ -41,17 +41,17 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=4.0.0 <6.0.0" + "version_requirement": ">=4.7.0 <6.0.0" } ], "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">=4.6.0 <5.0.0" + "version_requirement": ">=4.19.0 <5.0.0" }, { "name": "puppetlabs/apt", - "version_requirement": ">=2.0.0 <3.0.0" + "version_requirement": ">=2.1.0 <3.0.0" }, { "name": "puppetlabs/inifile", @@ -59,7 +59,7 @@ }, { "name": "puppetlabs/puppetdb", - "version_requirement": ">=5.0.0 <6.0.0" + "version_requirement": ">=6.0.1 <7.0.0" }, { "name": "puppet/r10k", From ec11c73422009f7cea5cf4d8510d4e310b920083 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Sat, 26 Aug 2017 14:12:23 -0400 Subject: [PATCH 4/4] Add puppet 5.1.0 and update gems --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b000944..0bda12c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,9 @@ matrix: - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.10.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.4.1 - env: PUPPET_GEM_VERSION="~> 5.0.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0" CHECK=test + env: PUPPET_GEM_VERSION="~> 5.0.0" FACTER_GEM_VERSION="~> 2.5" HIERA_GEM_VERSION="~> 3.4.0" CHECK=test + - rvm: 2.4.1 + env: PUPPET_GEM_VERSION="~> 5.1.0" FACTER_GEM_VERSION="~> 2.5" HIERA_GEM_VERSION="~> 3.4.0" CHECK=test branches: only: - production