Skip to content
Snippets Groups Projects
Commit 46040596 authored by Erik Reid's avatar Erik Reid
Browse files

raise from load_netconf_data instead of returning None

parent 2a78a62b
No related branches found
No related tags found
No related merge requests found
......@@ -249,7 +249,7 @@ def load_netconf_data(hostname):
r = get_redis(InventoryTask.config)
netconf = r.get('netconf:' + hostname)
if not netconf:
return None
raise InventoryTaskError('no netconf data found for %r' % hostname)
return etree.fromstring(netconf.decode('utf-8'))
......@@ -313,20 +313,19 @@ def reload_router_config(self, hostname):
# get the timestamp for the current netconf data
current_netconf_timestamp = None
netconf_doc = load_netconf_data(hostname)
if netconf_doc:
try:
netconf_doc = load_netconf_data(hostname)
current_netconf_timestamp \
= juniper.netconf_changed_timestamp(netconf_doc)
logger.debug(
'current netconf timestamp: %r' % current_netconf_timestamp)
except InventoryTaskError as e:
pass # ok at this point if not found
# load new netconf data
netconf_refresh_config.apply(args=[hostname])
netconf_doc = load_netconf_data(hostname)
if netconf_doc is None:
raise InventoryTaskError(
'failure loading netconf data for %r' % hostname)
# return if new timestamp is the same as the original timestamp
new_netconf_timestamp = juniper.netconf_changed_timestamp(netconf_doc)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment