Skip to content

Commit facc4f3

Browse files
committed
Ensure certs were deployed before we try to source them
1 parent 58fa4c7 commit facc4f3

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

manifests/plugin/remote_execution/mosquitto.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,10 @@
9191
group => 'mosquitto',
9292
mode => '0440',
9393
}
94+
95+
# Ensure certs were deployed before we try to source them
96+
# This is a workaround for https://tickets.puppetlabs.com/browse/PUP-3399
97+
File <| title == $ssl_cert |> ~> File["${mosquitto_ssl_dir}/ssl_cert.pem"]
98+
File <| title == $ssl_key |> ~> File["${mosquitto_ssl_dir}/ssl_key.pem"]
99+
File <| title == $ssl_ca |> ~> File["${mosquitto_ssl_dir}/ssl_ca.pem"]
94100
}

spec/classes/foreman_proxy__plugin__remote_execution__mosquitto_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@
8989
end
9090
end
9191

92+
describe 'with certs deployed by puppet' do
93+
let(:pre_condition) do
94+
<<-PUPPET
95+
file { '/etc/foreman-proxy/ssl_cert.pem': ensure => file }
96+
file { '/etc/foreman-proxy/ssl_key.pem': ensure => file }
97+
file { '/etc/foreman-proxy/ssl_ca.pem': ensure => file }
98+
PUPPET
99+
end
100+
101+
it 'should notify mosquitto certs when source changes' do
102+
should contain_file('/etc/foreman-proxy/ssl_cert.pem').with_notify(['File[/etc/mosquitto/ssl/ssl_cert.pem]'])
103+
should contain_file('/etc/foreman-proxy/ssl_key.pem').with_notify(['File[/etc/mosquitto/ssl/ssl_key.pem]'])
104+
should contain_file('/etc/foreman-proxy/ssl_ca.pem').with_notify(['File[/etc/mosquitto/ssl/ssl_ca.pem]'])
105+
end
106+
end
107+
92108
describe '' do
93109
let(:params) { super().merge(:ensure => 'absent') }
94110

0 commit comments

Comments
 (0)