Skip to content

Commit

Permalink
Merge pull request #625 from nautobot/patch-624-floor-locations-dont-…
Browse files Browse the repository at this point in the history
…respect-location-map

Correct Floors Being Loaded in DNAC When Location Map Used
  • Loading branch information
jdrew82 authored Dec 11, 2024
2 parents 9fe8877 + 5a6859b commit d27068b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changes/624.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed Floors respecting location map for Building related changes.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def load_buildings(self, buildings: List[dict]):
_area, _area_parent = None, None
if bldg_name in self.job.location_map and "parent" in self.job.location_map[bldg_name]:
_area = self.job.location_map[bldg_name]["parent"]
if "area_parent" in self.job.location_map[bldg_name]:
if self.job.location_map[bldg_name].get("area_parent"):
_area_parent = self.job.location_map[bldg_name]["area_parent"]
if "name" in self.job.location_map[bldg_name]:
if self.job.location_map[bldg_name].get("name"):
bldg_name = self.job.location_map[bldg_name]["name"]
elif location["parentId"] in self.dnac_location_map:
_area = self.dnac_location_map[location["parentId"]]["name"]
Expand Down Expand Up @@ -222,9 +222,10 @@ def load_floors(self, floors: List[dict]):
else:
self.job.logger.warning(f"Parent to {location['name']} can't be found so will be skipped.")
continue
if bldg_name in self.job.location_map and "name" in self.job.location_map[bldg_name]:
if self.job.location_map.get(bldg_name):
area_name = self.job.location_map[bldg_name]["parent"]
bldg_name = self.job.location_map[bldg_name]["name"]
if self.job.location_map[bldg_name].get("name"):
bldg_name = self.job.location_map[bldg_name]["name"]
floor_name = f"{bldg_name} - {location['name']}"
try:
parent = self.get(self.building, {"name": bldg_name, "area": area_name})
Expand Down

0 comments on commit d27068b

Please sign in to comment.