Fixed timeout variable scope issues
Partially-Fixes: #1473210 Change-Id: I5f6555fd6a00f2dc16ea120b598b21d08ef6b52a
This commit is contained in:
parent
16c84d40d7
commit
92d54232f9
@ -311,20 +311,22 @@ def do_axfr(zone_name, servers, timeout=None, source=None):
|
|||||||
Performs an AXFR for a given zone name
|
Performs an AXFR for a given zone name
|
||||||
"""
|
"""
|
||||||
random.shuffle(servers)
|
random.shuffle(servers)
|
||||||
timeout = timeout or 10
|
timeout = timeout or cfg.CONF["service:mdns"].xfr_timeout
|
||||||
|
|
||||||
xfr = None
|
xfr = None
|
||||||
|
|
||||||
for srv in servers:
|
for srv in servers:
|
||||||
timeout = eventlet.Timeout(timeout)
|
to = eventlet.Timeout(timeout)
|
||||||
log_info = {'name': zone_name, 'host': srv}
|
log_info = {'name': zone_name, 'host': srv}
|
||||||
try:
|
try:
|
||||||
LOG.info(_LI("Doing AXFR for %(name)s from %(host)s") % log_info)
|
LOG.info(_LI("Doing AXFR for %(name)s from %(host)s") % log_info)
|
||||||
|
|
||||||
xfr = dns.query.xfr(srv['ip'], zone_name, relativize=False,
|
xfr = dns.query.xfr(srv['ip'], zone_name, relativize=False,
|
||||||
timeout=1, port=srv['port'], source=source)
|
timeout=1, port=srv['port'], source=source)
|
||||||
raw_zone = dns.zone.from_xfr(xfr, relativize=False)
|
raw_zone = dns.zone.from_xfr(xfr, relativize=False)
|
||||||
break
|
break
|
||||||
except eventlet.Timeout as t:
|
except eventlet.Timeout as t:
|
||||||
if t == timeout:
|
if t == to:
|
||||||
msg = _LE("AXFR timed out for %(name)s from %(host)s")
|
msg = _LE("AXFR timed out for %(name)s from %(host)s")
|
||||||
LOG.error(msg % log_info)
|
LOG.error(msg % log_info)
|
||||||
continue
|
continue
|
||||||
@ -341,7 +343,7 @@ def do_axfr(zone_name, servers, timeout=None, source=None):
|
|||||||
"Trying next server.")
|
"Trying next server.")
|
||||||
LOG.exception(msg % log_info)
|
LOG.exception(msg % log_info)
|
||||||
finally:
|
finally:
|
||||||
timeout.cancel()
|
to.cancel()
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
msg = _LE("XFR failed for %(name)s. No servers in %(servers)s was "
|
msg = _LE("XFR failed for %(name)s. No servers in %(servers)s was "
|
||||||
|
Loading…
Reference in New Issue
Block a user