Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #25909 - make qpidd.service wait until the port is open #115

Merged
merged 1 commit into from Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions manifests/service.pp
Expand Up @@ -26,5 +26,17 @@
limits => $limits,
notify => Service['qpidd'],
}

systemd::dropin_file { 'wait-for-port.conf':
ensure => bool2str($qpid::ssl, 'present', 'absent'),
unit => 'qpidd.service',
content => template('qpid/wait-for-port.conf.erb'),
notify => Service['qpidd'],
}

if $qpid::ssl {
ensure_packages(['nc'])
Package['nc'] -> Systemd::Dropin_file['wait-for-port.conf']
}
}
}
29 changes: 29 additions & 0 deletions spec/classes/qpid_spec.rb
Expand Up @@ -21,6 +21,9 @@
is_expected.to contain_systemd__service_limits('qpidd.service')
.with_ensure('absent')
.that_notifies('Service[qpidd]')
is_expected.to contain_systemd__dropin_file('wait-for-port.conf')
.with_ensure('absent')
.that_notifies('Service[qpidd]')
end
end

Expand Down Expand Up @@ -50,6 +53,32 @@

it { is_expected.not_to contain_package('qpid-cpp-server-linearstore') }
end

context 'with ssl options' do
let :params do
{
ssl: true,
ssl_port: 5671,
ssl_cert_db: "/etc/pki/katello/nssdb",
ssl_cert_password_file: "/etc/pki/katello/nssdb/nss_db_password-file",
ssl_cert_name: "broker",
ssl_require_client_auth: true
}
end

it 'should configure systemd to wait for the ssl port to be open' do
is_expected.to contain_systemd__dropin_file('wait-for-port.conf')
.with_ensure('present')
.that_notifies('Service[qpidd]')
.that_requires('Package[nc]')
is_expected.to contain_package('nc')
.with_ensure('present')
verify_exact_contents(catalogue, '/etc/systemd/system/qpidd.service.d/wait-for-port.conf', [
"[Service]",
"ExecStartPost=/bin/bash -c 'while ! nc -z 127.0.0.1 5671; do sleep 1; done'"
])
end
end
end
end
end
2 changes: 2 additions & 0 deletions templates/wait-for-port.conf.erb
@@ -0,0 +1,2 @@
[Service]
ExecStartPost=/bin/bash -c 'while ! nc -z 127.0.0.1 <%= scope['qpid::ssl_port'] %>; do sleep 1; done'