Skip to content

Commit aceacd6

Browse files
Make if logic simpler
1 parent 4ee686d commit aceacd6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/cnaas_nms/devicehandler/sync_devices.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -947,13 +947,12 @@ def sync_devices(
947947
remove_sync_events(hostname)
948948
dev.last_seen = datetime.datetime.utcnow()
949949
if not dry_run and get_confirm_mode(confirm_mode_override) != 2:
950-
if failed_hosts:
951-
if get_confirm_mode(confirm_mode_override) == 1:
952-
logger.error(
953-
"One or more devices failed to commit configuration, they will roll back configuration"
954-
" in {}s: {}".format(api_settings.COMMIT_CONFIRMED_TIMEOUT, ", ".join(failed_hosts))
955-
)
956-
time.sleep(api_settings.COMMIT_CONFIRMED_TIMEOUT)
950+
if failed_hosts and get_confirm_mode(confirm_mode_override) == 1:
951+
logger.error(
952+
"One or more devices failed to commit configuration, they will roll back configuration"
953+
" in {}s: {}".format(api_settings.COMMIT_CONFIRMED_TIMEOUT, ", ".join(failed_hosts))
954+
)
955+
time.sleep(api_settings.COMMIT_CONFIRMED_TIMEOUT)
957956
logger.info("Releasing lock for devices from syncto job: {}".format(job_id))
958957
Joblock.release_lock(session, job_id=job_id)
959958

0 commit comments

Comments
 (0)