Skip to content

Commit 7c9c69a

Browse files
committed
Skip prune on source failure #490
1 parent 05badce commit 7c9c69a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

netbox-sync.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ def main():
8787
log.info("Initializing sources")
8888
sources = instantiate_sources()
8989

90+
# disable pruning if an enabled source is unavailable
91+
if nb_handler.settings.prune_enabled is True:
92+
for source in inventory.source_list:
93+
if getattr(source.settings, "enabled", False) is True and source.init_successful is False:
94+
nb_handler.settings.prune_enabled = False
95+
log.warning(f"disabling pruning as source '{source.name}' is unavailable")
96+
9097
# all sources are unavailable
9198
if len(sources) == 0:
9299
log.error("No working sources found. Exit.")

0 commit comments

Comments
 (0)