From 9a41851dcf9bda29d429c8f9549056d6b9c49969 Mon Sep 17 00:00:00 2001 From: lpconsulting321 Date: Tue, 3 Dec 2024 22:40:09 +0000 Subject: [PATCH] migrate from building_loctype to site_loctype --- .../slurpit/diffsync/adapters/slurpit.py | 4 ++-- nautobot_ssot/integrations/slurpit/jobs.py | 14 +++++++------- .../tests/slurpit/test_slurpit_adapter.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nautobot_ssot/integrations/slurpit/diffsync/adapters/slurpit.py b/nautobot_ssot/integrations/slurpit/diffsync/adapters/slurpit.py index db37f655..e8cb5e31 100644 --- a/nautobot_ssot/integrations/slurpit/diffsync/adapters/slurpit.py +++ b/nautobot_ssot/integrations/slurpit/diffsync/adapters/slurpit.py @@ -223,7 +223,7 @@ def load_locations(self): "longitude": format_latitude(site.longitude), "contact_phone": site.phonenumber, "physical_address": "\n".join(address), - "location_type__name": self.job.building_loctype.name, + "location_type__name": self.job.site_loctype.name, "status__name": "Active", "tags": [{"name": "SSoT Synced from Slurpit"}], "system_of_record": "Slurpit", @@ -296,7 +296,7 @@ def load_devices(self): "role__name": constants.DEFAULT_DEVICE_ROLE, "status__name": "Active", "primary_ip4__host": device.ipv4, - "location__location_type__name": self.job.building_loctype.name, + "location__location_type__name": self.job.site_loctype.name, "tags": [{"name": "SSoT Synced from Slurpit"}], "system_of_record": "Slurpit", "last_synced_from_sor": datetime.today().date().isoformat(), diff --git a/nautobot_ssot/integrations/slurpit/jobs.py b/nautobot_ssot/integrations/slurpit/jobs.py index 3cd9c841..06590a90 100644 --- a/nautobot_ssot/integrations/slurpit/jobs.py +++ b/nautobot_ssot/integrations/slurpit/jobs.py @@ -28,12 +28,12 @@ class SlurpitDataSource(DataSource, Job): # pylint: disable=too-many-instance-a label="Slurpit Instance", ) - building_loctype = ObjectVar( + site_loctype = ObjectVar( model=LocationType, queryset=LocationType.objects.all(), display_field="name", required=False, - label="Building LocationType", + label="Site LocationType", description="LocationType to use for imported Sites from Slurpit. If unspecified, will revert to Site LocationType.", ) @@ -117,7 +117,7 @@ def run( dryrun, memory_profiling, credentials, - building_loctype, + site_loctype, namespace, ignore_prefixes, sync_slurpit_tagged_only, @@ -127,10 +127,10 @@ def run( """Run the Slurpit DataSource job.""" self.logger.info("Running Slurpit DataSource job") self.credentials = credentials - self.building_loctype = building_loctype - if not self.building_loctype: - self.building_loctype = LocationType.objects.get_or_create(name="Site")[0] - self.building_loctype.content_types.add(ContentType.objects.get_for_model(Device)) + self.site_loctype = site_loctype + if not self.site_loctype: + self.site_loctype = LocationType.objects.get_or_create(name="Site")[0] + self.site_loctype.content_types.add(ContentType.objects.get_for_model(Device)) self.namespace = namespace if not self.namespace: self.namespace = Namespace.objects.get(name="Global") diff --git a/nautobot_ssot/tests/slurpit/test_slurpit_adapter.py b/nautobot_ssot/tests/slurpit/test_slurpit_adapter.py index af6bdd39..7cc7ed5f 100644 --- a/nautobot_ssot/tests/slurpit/test_slurpit_adapter.py +++ b/nautobot_ssot/tests/slurpit/test_slurpit_adapter.py @@ -47,8 +47,8 @@ def setUp(self): job = SlurpitDataSource() job.job_result = JobResult.objects.create(name=job.class_path, task_name="fake task", worker="default") - job.building_loctype = LocationType.objects.get_or_create(name="Site")[0] - job.namespace = Namespace.objects.get(name="Global") + job.site_loctype = LocationType.objects.get_or_create(name="Site")[0] + job.namespace = Namespace.objects.get_or_create(name="Global")[0] self.slurpit = SlurpitAdapter(job=job, api_client=slurpit_client) def site_effect(value):