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: 2 additions & 1 deletion manifests/foreman_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
String $owner = 'root',
Stdlib::Filemode $private_key_mode = '0440',
Stdlib::Filemode $public_key_mode = '0444',
Enum['present', 'absent'] $client_bundle_ensure = 'present',
) inherits certs {
$proxy_cert_name = "${hostname}-foreman-proxy"
$foreman_proxy_client_cert_name = "${hostname}-foreman-proxy-client"
Expand Down Expand Up @@ -152,7 +153,7 @@
}

cert_key_bundle { $foreman_proxy_ssl_client_bundle:
ensure => present,
ensure => $client_bundle_ensure,
certificate => "${certs::ssl_build_dir}/${hostname}/${foreman_proxy_client_cert_name}.crt",
private_key => "${certs::ssl_build_dir}/${hostname}/${foreman_proxy_client_cert_name}.key",
force_pkcs_1 => true,
Expand Down
53 changes: 53 additions & 0 deletions spec/acceptance/foreman_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,57 @@ class { 'certs::foreman_proxy':
it { should_not exist }
end
end

context 'with include_client_bundle absent' do
before(:context) do
on default, 'rm -rf /root/ssl-build /etc/foreman-proxy /etc/pki/katello'
end

it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
file { '/etc/foreman-proxy':
ensure => directory,
}

group { 'foreman-proxy':
ensure => present,
system => true,
}

class { 'certs::foreman_proxy':
client_bundle_ensure => 'absent',
}
PUPPET
end
end

describe file('/etc/foreman-proxy/ssl_cert.pem') do
it { should exist }
end

describe file('/etc/foreman-proxy/ssl_key.pem') do
it { should exist }
end

describe file('/etc/foreman-proxy/ssl_ca.pem') do
it { should exist }
end

describe file('/etc/foreman-proxy/foreman_ssl_cert.pem') do
it { should exist }
end

describe file('/etc/foreman-proxy/foreman_ssl_key.pem') do
it { should exist }
end

describe file('/etc/foreman-proxy/foreman_ssl_ca.pem') do
it { should exist }
end

describe file("/etc/pki/katello/private/#{fqdn}/#{fqdn}-foreman-proxy-client-bundle.pem") do
it { should_not exist }
end
end
end
Loading