Skip to content
Snippets Groups Projects
Commit a1fafee1 authored by Neda Moeini's avatar Neda Moeini
Browse files

Merge branch 'fix/fixed_app_context_error' into 'develop'

Fixed calling functions outside the app context error.

See merge request !38
parents fa7e42f1 bc1fa926
No related branches found
No related tags found
1 merge request!38Fixed calling functions outside the app context error.
...@@ -915,17 +915,20 @@ def interfaces(hostname=None): ...@@ -915,17 +915,20 @@ def interfaces(hostname=None):
return Response(result, mimetype="application/json") return Response(result, mimetype="application/json")
def get_netdash_equipment() -> Dict[str, str]: def get_netdash_equipment(config, use_next_redis=False) -> Dict[str, str]:
"""Get the netdash equipment mapping from redis.""" """Get the netdash equipment mapping from redis."""
current_redis = common.get_current_redis() if use_next_redis:
return json.loads(current_redis.get('netdash').decode('utf-8')) r = tasks_common.get_next_redis(config)
else:
r = tasks_common.get_current_redis(config)
return json.loads(r.get('netdash').decode('utf-8'))
def load_error_report_interfaces( def load_error_report_interfaces(
config, hostname=None, use_next_redis=False config, hostname=None, use_next_redis=False
): ):
interfaces = _load_interfaces(config, hostname, use_next_redis=use_next_redis) interfaces = _load_interfaces(config, hostname, use_next_redis=use_next_redis)
netdash_equipment = get_netdash_equipment() netdash_equipment = get_netdash_equipment(config, use_next_redis)
def filter_interface(interface: dict): def filter_interface(interface: dict):
return all( return all(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment