Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@
#
# $server_reports:: List of report types to include on the puppetserver
#
# $server_node_terminus:: Node data plugin for catalog compiling
#
# $server_external_nodes:: External nodes classifier executable
#
# $server_trusted_external_command:: The external trusted facts script to use.
Expand Down Expand Up @@ -683,6 +685,7 @@
Optional[Stdlib::Absolutepath] $server_puppetserver_rundir = $puppet::params::server_puppetserver_rundir,
Optional[Stdlib::Absolutepath] $server_puppetserver_logdir = $puppet::params::server_puppetserver_logdir,
Optional[Pattern[/^[\d]\.[\d]+\.[\d]+$/]] $server_puppetserver_version = $puppet::params::server_puppetserver_version,
Enum['plain', 'exec', 'classifier'] $server_node_terminus = $puppet::params::server_node_terminus,
Variant[Undef, String[0], Stdlib::Absolutepath] $server_external_nodes = $puppet::params::server_external_nodes,
Optional[Stdlib::Absolutepath] $server_trusted_external_command = $puppet::params::server_trusted_external_command,
Array[String] $server_cipher_suites = $puppet::params::server_cipher_suites,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
$server_ca = true
$server_ca_crl_sync = false
$server_reports = 'foreman'
$server_node_terminus = 'exec'
$server_external_nodes = "${dir}/node.rb"
$server_trusted_external_command = undef
$server_request_timeout = 60
Expand Down
3 changes: 3 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
#
# $reports:: List of report types to include on the puppetserver
#
# $node_terminus:: Node data plugin for catalog compiling
#
# $external_nodes:: External nodes classifier executable
#
# $trusted_external_command:: The external trusted facts script to use.
Expand Down Expand Up @@ -376,6 +378,7 @@
Stdlib::Absolutepath $puppetserver_dir = $puppet::server_puppetserver_dir,
Optional[Stdlib::Absolutepath] $ca_dir = $puppet::server_ca_dir,
Optional[Pattern[/^[\d]\.[\d]+\.[\d]+$/]] $puppetserver_version = $puppet::server_puppetserver_version,
Enum['plain', 'exec', 'classifier'] $node_terminus = $puppet::server_node_terminus,
Variant[Undef, String[0], Stdlib::Absolutepath] $external_nodes = $puppet::server_external_nodes,
Optional[Stdlib::Absolutepath] $trusted_external_command = $puppet::server_trusted_external_command,
Array[String] $cipher_suites = $puppet::server_cipher_suites,
Expand Down
26 changes: 25 additions & 1 deletion manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,38 @@
## General configuration
$ca_server = $puppet::ca_server
$ca_port = $puppet::ca_port
$server_node_terminus = $puppet::server::node_terminus
$server_external_nodes = $puppet::server::external_nodes
$server_environment_timeout = $puppet::server::environment_timeout
$trusted_external_command = $puppet::server::trusted_external_command
$primary_envs_dir = $puppet::server::envs_dir[0]

case $server_node_terminus {
'plain': {}
'exec': {
class { 'puppet::server::enc':
node_terminus => $server_node_terminus,
enc_path => $server_external_nodes,
}
}
'console': {
class { 'puppet::server::enc':
node_terminus => $server_node_terminus,
}
}
default: {
fail('Invalid value of $server_node_terminus')
}
}

if $server_external_nodes and $server_external_nodes != '' {
class { 'puppet::server::enc':
enc_path => $server_external_nodes,
node_terminus => $server_node_terminus,
enc_path => $server_external_nodes,
}
} else {
class { 'puppet::server::enc':

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this leads to duplicate class declaration

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bastelfreak fixed.
All tests now passes

node_terminus => $server_node_terminus,
}
}

Expand Down
16 changes: 12 additions & 4 deletions manifests/server/enc.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Set up the ENC config
# @api private
class puppet::server::enc (
Variant[Undef, String[0], Stdlib::Absolutepath] $enc_path = $puppet::server::external_nodes
Variant[Undef, String[0], Stdlib::Absolutepath] $enc_path = $puppet::server::external_nodes,
Enum['plain', 'exec', 'classifier'] $node_terminus = $puppet::server::node_terminus,
) {
puppet::config::server {
'external_nodes': value => $enc_path;
'node_terminus': value => 'exec';
if $enc_path and $enc_path != '' {
puppet::config::server {
'external_nodes': value => $enc_path;
'node_terminus': value => $node_terminus;
}
}
else {
puppet::config::server {
'node_terminus': value => $node_terminus;
}
}
}
27 changes: 25 additions & 2 deletions spec/classes/puppet_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
end

describe 'with no custom parameters' do
it { should compile.with_all_deps }

Check failure on line 50 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with no custom parameters is expected to compile into a catalogue without dependency cycles Failure/Error: it { should compile.with_all_deps } error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

# install
it { should contain_class('puppet::server::install') }

Check failure on line 53 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with no custom parameters is expected to contain Class[puppet::server::install] Failure/Error: it { should contain_class('puppet::server::install') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net
it { should contain_user('puppet') }

Check failure on line 54 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with no custom parameters is expected to contain User[puppet] Failure/Error: it { should contain_user('puppet') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net
it { should contain_package(puppetserver_pkg).with_install_options(nil) }

Check failure on line 55 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with no custom parameters is expected to contain Package[puppetserver] with install_options defined Failure/Error: it { should contain_package(puppetserver_pkg).with_install_options(nil) } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

# config
it { should contain_class('puppet::server::config') }

Check failure on line 58 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with no custom parameters is expected to contain Class[puppet::server::config] Failure/Error: it { should contain_class('puppet::server::config') } Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net
it { should contain_puppet__config__main('reports').with_value('foreman') }
it { should contain_puppet__config__main('hiera_config').with_value('$confdir/hiera.yaml') }
it { should contain_puppet__config__main('environmentpath').with_value(environments_dir) }
Expand Down Expand Up @@ -285,12 +285,25 @@
it { should contain_puppet__config__main('hiera_config').with_value('/etc/puppet/hiera/production/hiera.yaml') }
end

describe 'without foreman' do
describe 'without foreman, default external ENC' do
let(:params) do
super().merge(
server_foreman: false,
server_reports: 'store',
server_external_nodes: ''
)
end

it { should_not contain_class('puppetserver_foreman') }
it { should contain_puppet__config__server('node_terminus').with_value('exec') }
it { should contain_puppet__config__server('external_nodes').with_value('/etc/puppetlabs/puppet/node.rb') }
end

describe 'without foreman, plain ENC' do
let(:params) do
super().merge(
server_foreman: false,
server_reports: 'store',
node_terminus: 'plain'
)
end

Expand All @@ -299,6 +312,16 @@
it { should_not contain_puppet__config__server('external_nodes') }
end

describe 'invalid node_terminus' do
let(:params) do
super().merge(
server_node_terminus: 'loremIpsum',
)
end

it { should raise_error(Puppet::Error, %r{Invalid value of $server_node_terminus}) }
end

describe 'with server_default_manifest => true and undef content' do
let(:params) do
super().merge(server_default_manifest: true)
Expand Down Expand Up @@ -481,7 +504,7 @@
)
end

it 'should not sync the crl' do

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on debian-12-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on debian-11-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on fedora-36-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on rocky-9-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on almalinux-9-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on almalinux-8-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on oraclelinux-9-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on centos-9-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-9-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net

Check warning on line 507 in spec/classes/puppet_server_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

puppet on redhat-8-x86_64 with server_ca_crl_sync => true with server_ca => false and running "puppet apply" should not sync the crl Failure/Error: should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem') Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Puppet::Server::Enc] is already declared at (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 45); cannot redeclare (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61) (file: /home/runner/work/puppet-puppet/puppet-puppet/spec/fixtures/modules/puppet/manifests/server/config.pp, line: 61, column: 5) on node runnervm3jd5f.czavsppgnzce1nrf4ae5q21skg.bx.internal.cloudapp.net
# https://github.com/puppetlabs/rspec-puppet/issues/37
pending("rspec-puppet always sets $server_facts['servername']")
should_not contain_file('/etc/custom/puppetlabs/puppet/ssl/crl.pem')
Expand Down
Loading