diff --git a/nautobot_ssot/integrations/servicenow/diffsync/models.py b/nautobot_ssot/integrations/servicenow/diffsync/models.py index 04c61d6bd..490f2c601 100644 --- a/nautobot_ssot/integrations/servicenow/diffsync/models.py +++ b/nautobot_ssot/integrations/servicenow/diffsync/models.py @@ -32,7 +32,7 @@ def map_data_to_sn_record(self, data, mapping_entry, existing_record=None, clear column_name = mapping["reference"]["column"] if value is not None: # if clear_cache is set to True then clear the cache for the object - if clear_cache==True: + if clear_cache: self._sys_id_cache.setdefault(tablename, {}).setdefault(column_name, {})[value] = {} # Look in the cache first sys_id = self._sys_id_cache.get(tablename, {}).get(column_name, {}).get(value, None) @@ -85,7 +85,7 @@ def update(self, attrs): return self def delete(self): - """Delete an existing instance in ServiceNow if it does not exist in Nautobot. This code adds the ServiceNow object to the objects_to_delete[object_class] list. The actual delete occurs in the post-run method of adapter_servicenow.py.""" + """Delete an existing instance in ServiceNow if it does not exist in Nautobot. This code adds the ServiceNow object to the objects_to_delete dict of lists. The actual delete occurs in the post-run method of adapter_servicenow.py.""" entry = self.diffsync.mapping_data[self.get_type()] sn_resource = self.diffsync.client.resource(api_path=f"/table/{entry['table']}") query = self.map_data_to_sn_record(data=self.get_identifiers(), mapping_entry=entry) @@ -100,7 +100,9 @@ def delete(self): self.diffsync.job.logger.warning(f"{self._modelname} {self.get_identifiers()} will be deleted.") _object = sn_resource.get(query=query) self.diffsync.objects_to_delete[self._modelname].append(_object) - self.map_data_to_sn_record(data=self.get_identifiers(), mapping_entry=entry, clear_cache=True) # remove device cache + self.map_data_to_sn_record( + data=self.get_identifiers(), mapping_entry=entry, clear_cache=True + ) # remove device cache super().delete() return self