ipadiscovery: Return realm as a string
We don't have a use for realm as a bytes instance, return it as a string, otherwise there's a use of str() on bytes in py3. https://pagure.io/freeipa/issue/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
e8358eaea9
commit
1cab1e980c
1 file changed
+7
-1
@@ -531,7 +531,13 @@ class IPADiscovery(object):
|
||||
for answer in answers:
|
||||
root_logger.debug("DNS record found: %s", answer)
|
||||
if answer.strings:
|
||||
realm = answer.strings[0]
|
||||
try:
|
||||
realm = answer.strings[0].decode('utf-8')
|
||||
except UnicodeDecodeError as e:
|
||||
root_logger.debug(
|
||||
'A TXT record cannot be decoded as UTF-8: {err}'
|
||||
.format(err=e))
|
||||
continue
|
||||
if realm:
|
||||
break
|
||||
return realm
|
||||
|
||||
Reference in new issue
Block a user