|
|
590d18 |
From 29cf6ce568747eca90497a29aa21927ac2b69496 Mon Sep 17 00:00:00 2001
|
|
|
590d18 |
From: Petr Spacek <pspacek@redhat.com>
|
|
|
590d18 |
Date: Mon, 31 Aug 2015 17:58:07 +0200
|
|
|
590d18 |
Subject: [PATCH] DNSSEC: prevent ipa-ods-exporter from looping after service
|
|
|
590d18 |
auto-restart
|
|
|
590d18 |
|
|
|
590d18 |
It might happen that systemd will restart the service even if there is
|
|
|
590d18 |
no incomming connection to service socket. In that case we want to exit
|
|
|
590d18 |
because HSM synchronization is done before socket.accept() and we want
|
|
|
590d18 |
to synchronize HSM and DNS zones at the same time.
|
|
|
590d18 |
|
|
|
590d18 |
https://fedorahosted.org/freeipa/ticket/5273
|
|
|
590d18 |
|
|
|
590d18 |
Reviewed-By: Martin Basti <mbasti@redhat.com>
|
|
|
590d18 |
Reviewed-By: Oleg Fayans <ofayans@redhat.com>
|
|
|
590d18 |
---
|
|
|
590d18 |
daemons/dnssec/ipa-ods-exporter | 6 ++++++
|
|
|
590d18 |
1 file changed, 6 insertions(+)
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/daemons/dnssec/ipa-ods-exporter b/daemons/dnssec/ipa-ods-exporter
|
|
|
590d18 |
index 62eca71da10ee6f3efd4d391a274278875714570..9544db149aed6574a8962d6c8e6b6f1bc520d6db 100755
|
|
|
590d18 |
--- a/daemons/dnssec/ipa-ods-exporter
|
|
|
590d18 |
+++ b/daemons/dnssec/ipa-ods-exporter
|
|
|
590d18 |
@@ -25,6 +25,7 @@ import logging
|
|
|
590d18 |
import os
|
|
|
590d18 |
import subprocess
|
|
|
590d18 |
import socket
|
|
|
590d18 |
+import select
|
|
|
590d18 |
import sys
|
|
|
590d18 |
import systemd.daemon
|
|
|
590d18 |
import systemd.journal
|
|
|
590d18 |
@@ -346,7 +347,12 @@ def receive_systemd_command(log):
|
|
|
590d18 |
raise KeyError('Exactly one socket is expected.')
|
|
|
590d18 |
|
|
|
590d18 |
sck = socket.fromfd(fds[0], socket.AF_UNIX, socket.SOCK_STREAM)
|
|
|
590d18 |
+ rlist, wlist, xlist = select.select([sck], [], [], 0)
|
|
|
590d18 |
+ if not rlist:
|
|
|
590d18 |
+ log.critical('socket activation did not return socket with a command')
|
|
|
590d18 |
+ sys.exit(0)
|
|
|
590d18 |
|
|
|
590d18 |
+ log.debug('accepting new connection')
|
|
|
590d18 |
conn, addr = sck.accept()
|
|
|
590d18 |
log.debug('accepted new connection %s', repr(conn))
|
|
|
590d18 |
|
|
|
590d18 |
--
|
|
|
590d18 |
2.5.1
|
|
|
590d18 |
|