DNSSEC: prevent ipa-ods-exporter from looping after service auto-restart

It might happen that systemd will restart the service even if there is
no incomming connection to service socket. In that case we want to exit
because HSM synchronization is done before socket.accept() and we want
to synchronize HSM and DNS zones at the same time.

https://fedorahosted.org/freeipa/ticket/5273

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Oleg Fayans <ofayans@redhat.com>
This commit is contained in:
Petr Spacek authored and Martin Basti committed 2015-09-03 18:20:36 +02:00
1 parent e7a876d88a
commit f1436c4ed8
1 file changed
+6
+6
View File
@@ -26,6 +26,7 @@ import logging
import os
import subprocess
import socket
import select
import sys
import systemd.daemon
import systemd.journal
@@ -347,7 +348,12 @@ def receive_systemd_command(log):
raise KeyError('Exactly one socket is expected.')
sck = socket.fromfd(fds[0], socket.AF_UNIX, socket.SOCK_STREAM)
rlist, wlist, xlist = select.select([sck], [], [], 0)
if not rlist:
log.critical('socket activation did not return socket with a command')
sys.exit(0)
log.debug('accepting new connection')
conn, addr = sck.accept()
log.debug('accepted new connection %s', repr(conn))