Skip to content

Commit

Permalink
remove one nesting layer to reduce code complexity smell
Browse files Browse the repository at this point in the history
  • Loading branch information
indy-independence committed Nov 27, 2023
1 parent ce82f8a commit 080f6f1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/cnaas_nms/db/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,14 @@ def settings_syncstatus(updated_settings: set) -> Tuple[Set[DeviceType], Set[str
groupname = filename.split(os.path.sep)[1]
if groupname not in get_groups():
logger.warning("Group {} not found in database, syncstatus not updated".format(groupname))
else:
primary_group_mapping: Dict[str, str] = get_device_primary_groups()
for map_hostname, map_groupname in primary_group_mapping.items():
if groupname == map_groupname:
unsynced_hostnames.add(map_hostname)
continue
primary_group_mapping: Dict[str, str] = get_device_primary_groups()

Check warning on line 359 in src/cnaas_nms/db/git.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/db/git.py#L353-L359

Added lines #L353 - L359 were not covered by tests
# Find all hostnames that are mapped to this primary group
# and add them to the list of unsynced hostnames
for map_hostname, map_groupname in primary_group_mapping.items():
if groupname == map_groupname:
unsynced_hostnames.add(map_hostname)

Check warning on line 364 in src/cnaas_nms/db/git.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/db/git.py#L362-L364

Added lines #L362 - L364 were not covered by tests

except Exception as e:
logger.exception("Error in settings groups directory {}: {}".format(filename, str(e)))

Check warning on line 367 in src/cnaas_nms/db/git.py

View check run for this annotation

Codecov / codecov/patch

src/cnaas_nms/db/git.py#L366-L367

Added lines #L366 - L367 were not covered by tests
else:
Expand Down

0 comments on commit 080f6f1

Please sign in to comment.