Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 16 additions & 3 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@
## 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]

if $server_external_nodes and $server_external_nodes != '' {
class { 'puppet::server::enc':
enc_path => $server_external_nodes,
case $server_node_terminus {
'plain': {}
'exec': {
class { 'puppet::server::enc':
node_terminus => $server_node_terminus,
enc_path => $server_external_nodes,
}
}
'console', 'classifier': {
class { 'puppet::server::enc':
node_terminus => 'classifier',
}
}
default: {
fail('Invalid value of $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 @@ -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("#{etcdir}\/node.rb") }
end

describe 'without foreman, plain ENC' do
let(:params) do
super().merge(
server_foreman: false,
server_reports: 'store',
server_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{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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]

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') expected that the catalogue would not contain File[/etc/custom/puppetlabs/puppet/ssl/crl.pem]
# 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