From 1935f97e4d5ab77bbe82c327fcd4635877718b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 25 Mar 2022 15:00:32 -1000 Subject: [PATCH 1/4] Clone git repository as $user Instead of cloning as root and using a file resource to change files ownership to the configured user, directly clone the repository with this user. This fix a warning issued by puppet: Warning: The directory '/srv/puppetboard/puppetboard' contains 1936 entries, which exceeds the default soft limit 1000 Fixes #351 --- manifests/init.pp | 8 +------- spec/classes/puppetboard_spec.rb | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index b38b763a..fbc24bf6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -138,7 +138,7 @@ vcsrepo { "${basedir}/puppetboard": ensure => present, provider => git, - owner => $user, + user => $user, source => $git_source, revision => $revision, require => [ @@ -150,12 +150,6 @@ ], } - file { "${basedir}/puppetboard": - owner => $user, - recurse => true, - require => Vcsrepo["${basedir}/puppetboard"], - } - $pyvenv_proxy_env = $python_proxy ? { undef => [], default => [ diff --git a/spec/classes/puppetboard_spec.rb b/spec/classes/puppetboard_spec.rb index 22733210..0eb1f33f 100644 --- a/spec/classes/puppetboard_spec.rb +++ b/spec/classes/puppetboard_spec.rb @@ -18,7 +18,6 @@ it { is_expected.to contain_package('py38-puppetboard') } else it { is_expected.to contain_file('/srv/puppetboard/puppetboard/settings.py') } - it { is_expected.to contain_file('/srv/puppetboard/puppetboard') } it { is_expected.to contain_file('/srv/puppetboard') } it { is_expected.to contain_python__pyvenv('/srv/puppetboard/virtenv-puppetboard') } it { is_expected.to contain_vcsrepo('/srv/puppetboard/puppetboard') } From 56cd9acdc6ed702e3e98385dc264878c508abd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 27 Mar 2022 16:38:11 -1000 Subject: [PATCH 2/4] Add workaround for resource ordering We python module is fragile and automatic detection of the need of running pip install is sometimes broken. --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index fbc24bf6..e3142c26 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -148,6 +148,7 @@ before => [ File[$settings_file], ], + notify => Python::Requirements["${basedir}/puppetboard/requirements.txt"], } $pyvenv_proxy_env = $python_proxy ? { From c1da63a188af2f73f95185916b63e1cdd28634d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 27 Mar 2022 17:10:20 -1000 Subject: [PATCH 3/4] Skip acceptance tests on Puppet 6 / Debian 11 No puppetserver6 / puppetdb6 packages are available for Debian 11. --- spec/acceptance/class_spec.rb | 4 +++- spec/acceptance/support/puppetdb.rb | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 spec/acceptance/support/puppetdb.rb diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 7d978b66..e24ff85c 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -2,7 +2,9 @@ require 'spec_helper_acceptance' -describe 'puppetboard class' do +require_relative 'support/puppetdb' + +describe 'puppetboard class', if: has_puppetdb do case fact('os.family') when 'RedHat' apache_conf_file = '/etc/httpd/conf.d/25-puppetboard.conf' diff --git a/spec/acceptance/support/puppetdb.rb b/spec/acceptance/support/puppetdb.rb new file mode 100644 index 00000000..d38ccc2b --- /dev/null +++ b/spec/acceptance/support/puppetdb.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +def has_puppetdb + case host_inventory['facter']['os']['name'] + when 'Debian' + return false if ENV['BEAKER_PUPPET_COLLECTION'] == 'puppet6' && host_inventory['facter']['os']['release']['major'] == '11' + end + + true +end From 7366b4e3a5e29c1dd769a31caf48d75a2b2d648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 27 Mar 2022 17:13:22 -1000 Subject: [PATCH 4/4] Fix acceptance tests on Ubuntu 18.04 with Puppet 6 --- spec/setup_acceptance_node.pp | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 spec/setup_acceptance_node.pp diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp new file mode 100644 index 00000000..dd504d99 --- /dev/null +++ b/spec/setup_acceptance_node.pp @@ -0,0 +1,8 @@ +if $facts['os']['name'] == 'Ubuntu' { + # Needed for facter to fetch facts used by the postgresql module + if versioncmp($facts['facterversion'], '4.0.0') <= 0 { + package{ 'lsb-release': + ensure => present, + } + } +}