summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdaemons/dnssec/ipa-ods-exporter21
1 files changed, 14 insertions, 7 deletions
diff --git a/daemons/dnssec/ipa-ods-exporter b/daemons/dnssec/ipa-ods-exporter
index 748bce40d..d00dab9de 100755
--- a/daemons/dnssec/ipa-ods-exporter
+++ b/daemons/dnssec/ipa-ods-exporter
@@ -17,19 +17,21 @@ Purpose of this replacement is to upload keys generated by OpenDNSSEC to LDAP.
from __future__ import print_function
from datetime import datetime
-import dateutil.tz
-import dns.dnssec
-from gssapi.exceptions import GSSError
import logging
import os
import socket
import select
import sys
-import systemd.daemon
-import systemd.journal
import sqlite3
import traceback
+import dateutil.tz
+import dns.dnssec
+from gssapi.exceptions import GSSError
+import six
+import systemd.daemon
+import systemd.journal
+
import ipalib
from ipalib.constants import SOFTHSM_DNSSEC_TOKEN_LABEL
from ipalib.install.kinit import kinit_keytab
@@ -470,8 +472,11 @@ def receive_systemd_command():
# this implements cmdhandler_handle_cmd() logic
cmd = conn.recv(ODS_SE_MAXLINE).strip()
+ # ODS uses an ASCII protocol
+ if not isinstance(cmd, six.text_type):
+ cmd = cmd.decode('ascii')
logger.debug('received command "%s" from systemd socket', cmd)
- return (cmd, conn)
+ return cmd, conn
def parse_command(cmd):
"""Parse command to (exit code, message, zone_name) tuple.
@@ -516,7 +521,9 @@ def parse_command(cmd):
def send_systemd_reply(conn, reply):
# Reply & close connection early.
# This is necessary to let Enforcer to unlock the ODS DB.
- conn.send(reply + '\n')
+ if isinstance(reply, six.text_type):
+ reply = reply.encode('ascii')
+ conn.send(reply + b'\n')
conn.shutdown(socket.SHUT_RDWR)
conn.close()