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

leave re-raising for later (until we test properly)

parent b1f6a6ce
No related branches found
No related tags found
No related merge requests found
...@@ -562,12 +562,13 @@ def reload_lab_router_config_chorded(self, hostname): ...@@ -562,12 +562,13 @@ def reload_lab_router_config_chorded(self, hostname):
hostname, community, logical_systems, self.log_info) hostname, community, logical_systems, self.log_info)
self.log_info(f'updated configuration for lab {hostname}') self.log_info(f'updated configuration for lab {hostname}')
except Exception as e: except Exception:
errmsg = f'unhandled exception loading {hostname} info' errmsg = f'unhandled exception loading {hostname} info'
logger.exception(errmsg) logger.exception(errmsg)
update_latch_status(InventoryTask.config, pending=True, failure=True) update_latch_status(InventoryTask.config, pending=True, failure=True)
self.log_error(errmsg) self.log_error(errmsg)
raise e # TODO: re-raise and handle in some common way for all tasks
# raise
@app.task(base=InventoryTask, bind=True, name='reload_router_config') @app.task(base=InventoryTask, bind=True, name='reload_router_config')
...@@ -601,12 +602,13 @@ def reload_router_config_chorded(self, hostname): ...@@ -601,12 +602,13 @@ def reload_router_config_chorded(self, hostname):
snmp_refresh_peerings_chorded(hostname, community, logical_systems) snmp_refresh_peerings_chorded(hostname, community, logical_systems)
logger.info(f'updated configuration for {hostname}') logger.info(f'updated configuration for {hostname}')
except Exception as e: except Exception:
errmsg = f'unhandled exception loading {hostname} info' errmsg = f'unhandled exception loading {hostname} info'
logger.exception(errmsg) logger.exception(errmsg)
update_latch_status(InventoryTask.config, pending=True, failure=True) update_latch_status(InventoryTask.config, pending=True, failure=True)
self.log_error(errmsg) self.log_error(errmsg)
raise e # TODO: re-raise and handle in some common way for all tasks
# raise
def retrieve_and_persist_netconf_config( def retrieve_and_persist_netconf_config(
......
...@@ -3,6 +3,9 @@ just checks that the worker methods call the right functions ...@@ -3,6 +3,9 @@ just checks that the worker methods call the right functions
and some data ends up in the right place ... otherwise not very detailed and some data ends up in the right place ... otherwise not very detailed
""" """
import re import re
import pytest
from inventory_provider.tasks import worker from inventory_provider.tasks import worker
from inventory_provider.tasks.common import _get_redis from inventory_provider.tasks.common import _get_redis
...@@ -18,6 +21,9 @@ def backend_db(): ...@@ -18,6 +21,9 @@ def backend_db():
def test_netconf_refresh_config(mocked_worker_module, router): def test_netconf_refresh_config(mocked_worker_module, router):
if router in ['qfx.par.fr.geant.net', 'qfx.fra.de.geant.net']:
# expected to fail
pytest.skip(f'test data has no community string for {router}')
del backend_db()['netconf:' + router] del backend_db()['netconf:' + router]
worker.reload_router_config_chorded(router) worker.reload_router_config_chorded(router)
assert backend_db()['netconf:' + router] assert backend_db()['netconf:' + router]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment