Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmatthews committed Jul 16, 2021
1 parent a0d9c55 commit 9ff2d7b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1,212 deletions.
10 changes: 5 additions & 5 deletions nautobot_ssot_servicenow/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,25 @@ def lookup_object(self, model_name, unique_id):
"""Look up a Nautobot object based on the DiffSync model name and unique ID."""
if model_name == "location":
try:
return (Region.objects.get(name=unique_id), None)
return Region.objects.get(name=unique_id)
except Region.DoesNotExist:
pass
try:
return (Site.objects.get(name=unique_id), None)
return Site.objects.get(name=unique_id)
except Site.DoesNotExist:
pass
elif model_name == "device":
try:
return (Device.objects.get(name=unique_id), None)
return Device.objects.get(name=unique_id)
except Device.DoesNotExist:
pass
elif model_name == "interface":
device_name, interface_name = unique_id.split("__")
try:
return (Interface.objects.get(device__name=device_name, name=interface_name), None)
return Interface.objects.get(device__name=device_name, name=interface_name)
except Interface.DoesNotExist:
pass
return (None, None)
return None


jobs = [ServiceNowDataTarget]
Loading

0 comments on commit 9ff2d7b

Please sign in to comment.