diff --git a/manifests/service.pp b/manifests/service.pp index d4c4ebf..6e5f599 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -34,8 +34,8 @@ } if $qpid::ssl { - ensure_packages(['nc']) - Package['nc'] -> Systemd::Dropin_file['wait-for-port.conf'] + ensure_packages(['iproute']) + Package['iproute'] -> Systemd::Dropin_file['wait-for-port.conf'] } } } diff --git a/spec/classes/qpid_spec.rb b/spec/classes/qpid_spec.rb index c18b7d0..f16756c 100644 --- a/spec/classes/qpid_spec.rb +++ b/spec/classes/qpid_spec.rb @@ -121,12 +121,12 @@ 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') + .that_requires('Package[iproute]') + is_expected.to contain_package('iproute') .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 localhost 5671; do sleep 1; done'" + "ExecStartPost=/bin/bash -c 'while ! ss --no-header --tcp --listening --numeric sport = :5671 | grep -q \"^LISTEN.*:5671\"; do sleep 1; done'" ]) end end diff --git a/templates/wait-for-port.conf.erb b/templates/wait-for-port.conf.erb index 6226f16..8e59d18 100644 --- a/templates/wait-for-port.conf.erb +++ b/templates/wait-for-port.conf.erb @@ -1,2 +1,2 @@ [Service] -ExecStartPost=/bin/bash -c 'while ! nc -z localhost <%= scope['qpid::ssl_port'] %>; do sleep 1; done' +ExecStartPost=/bin/bash -c 'while ! ss --no-header --tcp --listening --numeric sport = :<%= scope['qpid::ssl_port'] %> | grep -q "^LISTEN.*:<%= scope['qpid::ssl_port'] %>"; do sleep 1; done'