Use root_logger for verify_host_resolvable()

After discussion with Martin Basti we decided to standardize on root_logger
with hope that one day we will use root_logger.getLogger('module')
to make logging prettier and tunable per module.

https://fedorahosted.org/freeipa/ticket/5710

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Spacek
2016-05-17 17:20:25 +02:00
committed by Martin Basti
parent 0c75df4bf3
commit ec49130b94
8 changed files with 16 additions and 14 deletions

View File

@@ -43,6 +43,7 @@ from ipapython.ssh import SSHPublicKey
from ipapython.dn import DN, RDN
from ipapython.dnsutil import DNSName
from ipapython.graph import Graph
from ipapython.ipa_log_manager import root_logger
if six.PY3:
unicode = str
@@ -64,7 +65,8 @@ def json_serialize(obj):
return ''
return json_serialize(obj.__json__())
def verify_host_resolvable(fqdn, log):
def verify_host_resolvable(fqdn):
"""
See if the hostname has a DNS A/AAAA record.
"""
@@ -75,12 +77,12 @@ def verify_host_resolvable(fqdn, log):
for rdtype in ('A', 'AAAA'):
try:
answers = resolver.query(fqdn, rdtype)
log.debug(
root_logger.debug(
'IPA: found %d %s records for %s: %s' % (len(answers),
rdtype, fqdn, ' '.join(str(answer) for answer in answers))
)
except DNSException:
log.debug(
root_logger.debug(
'IPA: DNS %s record lookup failed for %s' %
(rdtype, fqdn)
)