Skip to content

Commit

Permalink
Implement SNOW SSOT 'delete_records' flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
progala committed Oct 3, 2024
1 parent bfdbc8f commit 116d76f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nautobot_ssot/integrations/servicenow/jobs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""ServiceNow Data Target Job."""

from diffsync.enum import DiffSyncFlags
from django.core.exceptions import ObjectDoesNotExist
from django.templatetags.static import static
from django.urls import reverse
Expand All @@ -21,8 +22,7 @@ class ServiceNowDataTarget(DataTarget, Job): # pylint: disable=abstract-method

debug = BooleanVar(description="Enable for more verbose logging.")

# TODO: Implement or remove
# delete_records = BooleanVar(description="Delete synced records from ServiceNow if not present in Nautobot")
delete_records = BooleanVar(description="Delete synced records from ServiceNow if not present in Nautobot")

site_filter = ObjectVar(
description="Only sync records belonging to a single Site.",
Expand Down Expand Up @@ -80,11 +80,14 @@ def load_target_adapter(self):
self.target_adapter = ServiceNowDiffSync(client=snc, job=self, sync=self.sync, site_filter=self.site_filter)
self.target_adapter.load()

def run(self, dryrun, memory_profiling, site_filter, *args, **kwargs): # pylint:disable=arguments-differ
def run(self, dryrun, memory_profiling, delete_records, site_filter, *args, **kwargs): # pylint:disable=arguments-differ
"""Run sync."""
self.dryrun = dryrun
self.memory_profiling = memory_profiling
self.site_filter = site_filter
self.delete_records = delete_records
if not self.delete_records:
self.diffsync_flags |= DiffSyncFlags.SKIP_UNMATCHED_DST
super().run(dryrun, memory_profiling, *args, **kwargs)

def lookup_object(self, model_name, unique_id):
Expand Down

0 comments on commit 116d76f

Please sign in to comment.