From 8ec8e24015df29bae97fa58d1a7ae12d28639d25 Mon Sep 17 00:00:00 2001 From: Alex Zeleznikov Date: May 16 2017 07:43:56 +0000 Subject: Sort SRV records by priority In some cases where multiple SRV records are present, LDAP and Kerberos records were returned in different order, causing replication issues in a multi master enviorment. Update ipadiscovery.py Reviewed-By: Christian Heimes Reviewed-By: Martin Basti --- diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py index 46e05c9..c929a35 100644 --- a/ipaclient/install/ipadiscovery.py +++ b/ipaclient/install/ipadiscovery.py @@ -17,6 +17,7 @@ # along with this program. If not, see . # +import operator import socket import six @@ -493,6 +494,7 @@ class IPADiscovery(object): try: answers = resolver.query(qname, rdatatype.SRV) + answers = sorted(answers, key=operator.attrgetter('priority')) except DNSException as e: root_logger.debug("DNS record not found: %s", e.__class__.__name__) answers = []