From 7398819200c9a3a32effa52793240a054bc4b10f Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Tue, 15 Dec 2015 14:16:52 +0100 Subject: [PATCH] DNSSEC: logging improvements in ipa-ods-exporter https://fedorahosted.org/freeipa/ticket/5348 Reviewed-By: Martin Basti Reviewed-By: Martin Basti --- daemons/dnssec/ipa-ods-exporter | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/daemons/dnssec/ipa-ods-exporter b/daemons/dnssec/ipa-ods-exporter index 6ed7588847042e742abeef724940eec31f23ca8f..051fa53a950f7afbea5e9b1e541a9435aa02bc17 100755 --- a/daemons/dnssec/ipa-ods-exporter +++ b/daemons/dnssec/ipa-ods-exporter @@ -491,6 +491,11 @@ def cmd2ods_zone_name(cmd): return zone_name def sync_zone(log, ldap, dns_dn, zone_name): + """synchronize metadata about zone keys for single DNS zone + + Key material has to be synchronized elsewhere. + Keep in mind that keys could be shared among multiple zones!""" + log.getChild("%s.%s" % (__name__, zone_name)) log.debug('synchronizing zone "%s"', zone_name) ods_keys = get_ods_keys(zone_name) ods_keys_id = set(ods_keys.keys()) @@ -523,30 +528,30 @@ def sync_zone(log, ldap, dns_dn, zone_name): ldap_keys_id = set(ldap_keys.keys()) new_keys_id = ods_keys_id - ldap_keys_id - log.info('new keys from ODS: %s', new_keys_id) + log.info('new key metadata from ODS: %s', new_keys_id) for key_id in new_keys_id: cn = "cn=%s" % key_id key_dn = DN(cn, keys_dn) - log.debug('adding key "%s" to LDAP', key_dn) + log.debug('adding key metadata "%s" to LDAP', key_dn) ldap_key = ldap.make_entry(key_dn, objectClass=['idnsSecKey'], **ods_keys[key_id]) ldap.add_entry(ldap_key) deleted_keys_id = ldap_keys_id - ods_keys_id - log.info('deleted keys in LDAP: %s', deleted_keys_id) + log.info('deleted key metadata in LDAP: %s', deleted_keys_id) for key_id in deleted_keys_id: cn = "cn=%s" % key_id key_dn = DN(cn, keys_dn) - log.debug('deleting key "%s" from LDAP', key_dn) + log.debug('deleting key metadata "%s" from LDAP', key_dn) ldap.delete_entry(key_dn) update_keys_id = ldap_keys_id.intersection(ods_keys_id) - log.info('keys in LDAP & ODS: %s', update_keys_id) + log.info('key metadata in LDAP & ODS: %s', update_keys_id) for key_id in update_keys_id: ldap_key = ldap_keys[key_id] ods_key = ods_keys[key_id] - log.debug('updating key "%s" in LDAP', ldap_key.dn) + log.debug('updating key metadata "%s" in LDAP', ldap_key.dn) ldap_key.update(ods_key) try: ldap.update_entry(ldap_key) -- 2.4.3