Skip to content
Snippets Groups Projects
Commit 899a0666 authored by Sam Roberts's avatar Sam Roberts
Browse files

make things a little more legible

parent 81cb4cb3
No related branches found
No related tags found
1 merge request!43Regions included in dashboard generation
......@@ -876,9 +876,10 @@ def load_interfaces_to_poll(config, hostname=None, no_lab=False, use_next_redis=
_get_services_and_customers(config, hostname, use_next_redis)
snmp_indexes = common.load_snmp_indexes(config, hostname, use_next_redis)
nren_regions = _load_nren_regions(config, use_next_redis)
unique_regions = set([value for value in nren_regions.values()])
region_index = {region_key: [nren for nren, reg in nren_regions.items() if reg == region_key]
for region_key in unique_regions}
unique_regions = set(nren_regions.values())
region_index = {}
for region_key in unique_regions:
region_index[region_key] = {nren for nren, reg in nren_regions.items() if reg == region_key}
def _get_populated_interfaces(all_interfaces):
if use_next_redis:
......@@ -907,9 +908,12 @@ def load_interfaces_to_poll(config, hostname=None, no_lab=False, use_next_redis=
ifc['circuits'] = ifc_services_and_customers['services']
_customers = ifc_services_and_customers.get('customers', [])
customer_set = {c['name'] for c in _customers}
region = None
for region_name in region_index:
if any(customer['name'] in region_index[region_name] for customer in _customers):
# check if any of the customers are in this region
if any(region_index[region_name] & customer_set):
# customers will only have one region, so if there's a match, break here
region = region_name
break
dashboards = _get_dashboards(ifc, region)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment