Skip to content

Commit

Permalink
fixes issue with renamed class attributes from last commit bb-Ricardo…
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-Ricardo authored and kuznetsov andrei committed Oct 9, 2024
1 parent e697e4c commit bbcda58
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions module/netbox/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ def prune_data(self):

log.info("Pruning orphaned data in NetBox")

disabled_sources_tags = [x.source_tag for x in self.source_list if getattr(x, "enabled") is False]

# update all items in NetBox accordingly
today = datetime.now()
for nb_object_sub_class in reversed(NetBoxObject.__subclasses__()):
Expand All @@ -780,17 +782,17 @@ def prune_data(self):
if this_object.source is not None:
continue

if self.orphaned_tag not in this_object.get_tags():
this_object_tags = this_object.get_tags()

if self.orphaned_tag not in this_object_tags:
continue

date_last_update = grab(this_object, "data.last_updated")

if date_last_update is None:
continue

if bool(
set(this_object.get_tags()).intersection(self.inventory.source_tags_of_disabled_sources)
) is True:
if bool(set(this_object_tags).intersection(disabled_sources_tags)) is True:
log.debug2(f"Object '{this_object.get_display_name()}' was added "
f"from a currently disabled source. Skipping pruning.")
continue
Expand Down

0 comments on commit bbcda58

Please sign in to comment.