[Freeipa-devel] [freeipa PR#689][comment] Sort SRV records by priority

2017-05-15 Thread alex-zel
  URL: https://github.com/freeipa/freeipa/pull/689
Title: #689: Sort SRV records by priority

alex-zel commented:
"""
Thanks, sorry I didn't get to it.
"""

See the full comment at 
https://github.com/freeipa/freeipa/pull/689#issuecomment-301681362
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#689][synchronized] Sort SRV records by priority

2017-04-24 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/689
Author: alex-zel
 Title: #689: Sort SRV records by priority
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/689/head:pr689
git checkout pr689
From 283da88845c65d5cd3b4ce6b5e32c17fc3c5fb98 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH 1/3] 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.
---
 ipaclient/install/ipadiscovery.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..b30e7de 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -22,13 +22,14 @@
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns import resolver, rdatatype
 from dns.exception import DNSException
+from dns import resolver, rdatatype
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
+from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
+answers = sorted(answers, key=attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 78cac5d5ed7b1b857093667dad66dc1dc6f86670 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Thu, 6 Apr 2017 10:06:36 +0300
Subject: [PATCH 2/3] Update ipadiscovery.py

---
 ipaclient/install/ipadiscovery.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index b30e7de..c929a35 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -17,19 +17,19 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import operator
 import socket
 
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns.exception import DNSException
 from dns import resolver, rdatatype
+from dns.exception import DNSException
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
-from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -494,7 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
-answers = sorted(answers, key=attrgetter('priority'))
+answers = sorted(answers, key=operator.attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From ca4b37023314fc5125defc015a1fdafaacef1be2 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH 3/3] 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
---
 ipaclient/install/ipadiscovery.py | 2 ++
 1 file changed, 2 insertions(+)

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 <http://www.gnu.org/licenses/>.
 #
 
+import operator
 import socket
 
 import six
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 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 = []
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#689][comment] Sort SRV records by priority

2017-04-06 Thread alex-zel
  URL: https://github.com/freeipa/freeipa/pull/689
Title: #689: Sort SRV records by priority

alex-zel commented:
"""
Sorry I think I messed up trying to squash the commits
"""

See the full comment at 
https://github.com/freeipa/freeipa/pull/689#issuecomment-292140831
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#689][synchronized] Sort SRV records by priority

2017-04-06 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/689
Author: alex-zel
 Title: #689: Sort SRV records by priority
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/689/head:pr689
git checkout pr689
From 283da88845c65d5cd3b4ce6b5e32c17fc3c5fb98 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH 1/3] 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.
---
 ipaclient/install/ipadiscovery.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..b30e7de 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -22,13 +22,14 @@
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns import resolver, rdatatype
 from dns.exception import DNSException
+from dns import resolver, rdatatype
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
+from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
+answers = sorted(answers, key=attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 78cac5d5ed7b1b857093667dad66dc1dc6f86670 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Thu, 6 Apr 2017 10:06:36 +0300
Subject: [PATCH 2/3] Update ipadiscovery.py

---
 ipaclient/install/ipadiscovery.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index b30e7de..c929a35 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -17,19 +17,19 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import operator
 import socket
 
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns.exception import DNSException
 from dns import resolver, rdatatype
+from dns.exception import DNSException
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
-from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -494,7 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
-answers = sorted(answers, key=attrgetter('priority'))
+answers = sorted(answers, key=operator.attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From ca4b37023314fc5125defc015a1fdafaacef1be2 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH 3/3] 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
---
 ipaclient/install/ipadiscovery.py | 2 ++
 1 file changed, 2 insertions(+)

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 <http://www.gnu.org/licenses/>.
 #
 
+import operator
 import socket
 
 import six
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 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 = []
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#689][synchronized] Sort SRV records by priority

2017-04-06 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/689
Author: alex-zel
 Title: #689: Sort SRV records by priority
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/689/head:pr689
git checkout pr689
From 283da88845c65d5cd3b4ce6b5e32c17fc3c5fb98 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH 1/2] 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.
---
 ipaclient/install/ipadiscovery.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..b30e7de 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -22,13 +22,14 @@
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns import resolver, rdatatype
 from dns.exception import DNSException
+from dns import resolver, rdatatype
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
+from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
+answers = sorted(answers, key=attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 78cac5d5ed7b1b857093667dad66dc1dc6f86670 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Thu, 6 Apr 2017 10:06:36 +0300
Subject: [PATCH 2/2] Update ipadiscovery.py

---
 ipaclient/install/ipadiscovery.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index b30e7de..c929a35 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -17,19 +17,19 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import operator
 import socket
 
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns.exception import DNSException
 from dns import resolver, rdatatype
+from dns.exception import DNSException
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
-from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -494,7 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
-answers = sorted(answers, key=attrgetter('priority'))
+answers = sorted(answers, key=operator.attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#689][opened] Sort SRV records by priority

2017-04-04 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/689
Author: alex-zel
 Title: #689: Sort SRV records by priority
Action: opened

PR body:
"""
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.

## Replication:
DNS configuration (using PfSense):
```
srv-host=_kerberos._udp.example.com,server01.example.com,88,0,1
srv-host=_kerberos._tcp.example.com,server01.example.com,88,0,1
srv-host=_kerberos-master._tcp.example.com,server01.example.com,88,0,1
srv-host=_kerberos-master._udp.example.com,server01.example.com,88,0,1
srv-host=_kpasswd._tcp.example.com,server01.example.com,88,0,1
srv-host=_kpasswd._udp.example.com,server01.example.com,88,0,1
srv-host=_ldap._tcp.example.com,server01.example.com,389,0,1
srv-host=_kerberos._udp.example.com,server02.example.com,88,0,2
srv-host=_kerberos._tcp.example.com,server02.example.com,88,0,2
srv-host=_kerberos-master._tcp.example.com,server02.example.com,88,0,2
srv-host=_kerberos-master._udp.example.com,server02.example.com,88,0,2
srv-host=_kpasswd._tcp.example.com,server02.example.com,88,0,2
srv-host=_kpasswd._udp.example.com,server02.example.com,88,0,2
srv-host=_ldap._tcp.example.com,server02.example.com,389,0,2
txt-record=_kerberos.example.com,EXAMPLE.COM
```

Client installation:
Host record is added beforehand from web UI on server01.example.com ONLY.
`/usr/sbin/ipa-client-install --force-join --principal=bind_user 
--password=bind_pass --hostname=`hostname -f` --unattended`

/var/log/ipaclient-install.log:

> 2017-04-02T10:54:09Z DEBUG [IPA Discovery]
> 2017-04-02T10:54:09Z DEBUG Starting IPA discovery with domain=None, 
> servers=None, hostname=client01.example.com
> 2017-04-02T10:54:09Z DEBUG Start searching for LDAP SRV record in 
> "example.com" (domain of the hostname) and its sub-domains
> 2017-04-02T10:54:09Z DEBUG Search DNS for SRV record of _ldap._tcp.example.com
> 2017-04-02T10:54:09Z DEBUG DNS record found: 0 1 389 server01.example.com.
> 2017-04-02T10:54:09Z DEBUG DNS record found: 0 2 389 server02.example.com.
> 2017-04-02T10:54:09Z DEBUG [Kerberos realm search]
> 2017-04-02T10:54:09Z DEBUG Search DNS for TXT record of _kerberos.example.com
> 2017-04-02T10:54:09Z DEBUG DNS record not found: NoAnswer
> 2017-04-02T10:54:09Z DEBUG Search DNS for SRV record of 
> _kerberos._udp.example.com
> 2017-04-02T10:54:09Z DEBUG DNS record found: 0 2 88 server02.example.com.
> 2017-04-02T10:54:09Z DEBUG DNS record found: 0 1 88 server01.example.com.

Notice the records are not in the same order, ipa-client-install did not return 
any error and the client machine could see user, groups, netgroups, but users 
could not authenticate.
Looking at the web UI, server01.example.com shows the client is not enrolled 
and no kerberos key is present, but server02.example.com shows the client is 
enrolled and has a key.

In cases were either server01 or server02 were returned first in IPA Discovery 
the installation and replication went fine.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/689/head:pr689
git checkout pr689
From 283da88845c65d5cd3b4ce6b5e32c17fc3c5fb98 Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Tue, 4 Apr 2017 09:42:10 +0300
Subject: [PATCH] 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.
---
 ipaclient/install/ipadiscovery.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..b30e7de 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -22,13 +22,14 @@
 import six
 
 from ipapython.ipa_log_manager import root_logger
-from dns import resolver, rdatatype
 from dns.exception import DNSException
+from dns import resolver, rdatatype
 from ipalib import errors
 from ipapython import ipaldap
 from ipaplatform.paths import paths
 from ipapython.ipautil import valid_ip, realm_to_suffix
 from ipapython.dn import DN
+from operator import attrgetter
 
 NOT_FQDN = -1
 NO_LDAP_SERVER = -2
@@ -493,6 +494,7 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = resolver.query(qname, rdatatype.SRV)
+answers = sorted(answers, key=attrgetter('priority'))
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#681][closed] Fix ipadiscovery

2017-04-04 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/681
Author: alex-zel
 Title: #681: Fix ipadiscovery
Action: closed

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/681/head:pr681
git checkout pr681
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#681][synchronized] Fix ipadiscovery

2017-04-04 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/681
Author: alex-zel
 Title: #681: Fix ipadiscovery
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/681/head:pr681
git checkout pr681
From 3ac30ca118685134dd38b07e4b55ecbb4c880a3a Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Sun, 2 Apr 2017 11:53:11 +0300
Subject: [PATCH 1/3] ipadiscovery sort SRV record by priority

Sort SRV records for LDAP/KRB based on priority.
---
 ipaclient/install/ipadiscovery.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..c6fc240 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -492,7 +492,16 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 root_logger.debug("Search DNS for SRV record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.SRV)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -521,7 +530,16 @@ def ipadnssearchkrbrealm(self, domain=None):
 root_logger.debug("Search DNS for TXT record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.TXT)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 993c99868f3e033122bfe6fc95f53c701243d3f0 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Sun, 2 Apr 2017 12:04:11 +0300
Subject: [PATCH 2/3] fix indentation

---
 ipaclient/install/ipadiscovery.py | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index c6fc240..4f18398 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -493,15 +493,15 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -531,15 +531,15 @@ def ipadnssearchkrbrealm(self, domain=None):
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
     answers = []

From 73fc5dc8cf1b8c6f34ff767079aa2209b26c2aa1 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Tue, 4 Apr 2017 08:57:04 +0300
Subject: [PATCH 3/3] Update ipadiscovery.py

---
 ipaclient/install/ipadiscovery.py | 24 
 1 file changed, 4 insertions(+),

[Freeipa-devel] [freeipa PR#681][synchronized] Fix ipadiscovery

2017-04-03 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/681
Author: alex-zel
 Title: #681: Fix ipadiscovery
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/681/head:pr681
git checkout pr681
From 3ac30ca118685134dd38b07e4b55ecbb4c880a3a Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Sun, 2 Apr 2017 11:53:11 +0300
Subject: [PATCH 1/3] ipadiscovery sort SRV record by priority

Sort SRV records for LDAP/KRB based on priority.
---
 ipaclient/install/ipadiscovery.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..c6fc240 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -492,7 +492,16 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 root_logger.debug("Search DNS for SRV record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.SRV)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -521,7 +530,16 @@ def ipadnssearchkrbrealm(self, domain=None):
 root_logger.debug("Search DNS for TXT record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.TXT)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 993c99868f3e033122bfe6fc95f53c701243d3f0 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Sun, 2 Apr 2017 12:04:11 +0300
Subject: [PATCH 2/3] fix indentation

---
 ipaclient/install/ipadiscovery.py | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index c6fc240..4f18398 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -493,15 +493,15 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -531,15 +531,15 @@ def ipadnssearchkrbrealm(self, domain=None):
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
     answers = []

From 3c957c5b1407d89ddbd81eda99bdd4056d1ebc51 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Tue, 4 Apr 2017 08:57:04 +0300
Subject: [PATCH 3/3] Update ipadiscovery.py

---
 ipaclient/install/ipadiscovery.py | 24 
 1 file changed, 4 insertions(+),

[Freeipa-devel] [freeipa PR#681][opened] Fix ipadiscovery

2017-04-02 Thread alex-zel
   URL: https://github.com/freeipa/freeipa/pull/681
Author: alex-zel
 Title: #681: Fix ipadiscovery
Action: opened

PR body:
"""
Sort SRV records for LDAP/KRB based on priority.

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/681/head:pr681
git checkout pr681
From 3ac30ca118685134dd38b07e4b55ecbb4c880a3a Mon Sep 17 00:00:00 2001
From: Alex Zeleznikov <a...@iucc.ac.il>
Date: Sun, 2 Apr 2017 11:53:11 +0300
Subject: [PATCH 1/2] ipadiscovery sort SRV record by priority

Sort SRV records for LDAP/KRB based on priority.
---
 ipaclient/install/ipadiscovery.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index 46e05c9..c6fc240 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -492,7 +492,16 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 root_logger.debug("Search DNS for SRV record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.SRV)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -521,7 +530,16 @@ def ipadnssearchkrbrealm(self, domain=None):
 root_logger.debug("Search DNS for TXT record of %s", qname)
 
 try:
-answers = resolver.query(qname, rdatatype.TXT)
+answers = []
+			dns_answers = resolver.query(qname, rdatatype.SRV)
+			for answer in dns_answers:
+if not len(answers):
+	answers.append(answer)
+else:
+	i = 0
+	while i < len(answers) and answer.priority > answers[i].priority:
+		i += 1
+	answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []

From 993c99868f3e033122bfe6fc95f53c701243d3f0 Mon Sep 17 00:00:00 2001
From: Alex Zel <alex88...@gmail.com>
Date: Sun, 2 Apr 2017 12:04:11 +0300
Subject: [PATCH 2/2] fix indentation

---
 ipaclient/install/ipadiscovery.py | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/ipaclient/install/ipadiscovery.py b/ipaclient/install/ipadiscovery.py
index c6fc240..4f18398 100644
--- a/ipaclient/install/ipadiscovery.py
+++ b/ipaclient/install/ipadiscovery.py
@@ -493,15 +493,15 @@ def ipadns_search_srv(self, domain, srv_record_name, default_port,
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
@@ -531,15 +531,15 @@ def ipadnssearchkrbrealm(self, domain=None):
 
 try:
 answers = []
-			dns_answers = resolver.query(qname, rdatatype.SRV)
-			for answer in dns_answers:
-if not len(answers):
-	answers.append(answer)
-else:
-	i = 0
-	while i < len(answers) and answer.priority > answers[i].priority:
-		i += 1
-	answers.insert(i, answer)
+dns_answers = resolver.query(qname, rdatatype.SRV)
+for answer in dns_answers:
+if not len(answers):
+answers.append(answer)
+else:
+i = 0
+while i < len(answers) and answer.priority > answers[i].priority:
+i += 1
+answers.insert(i, answer)
 except DNSException as e:
 root_logger.debug("DNS record not found: %s", e.__class__.__name__)
 answers = []
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code