Skip to content

update vlan adapter #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/372.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed bug when loading Nautobot Vlans with multiple locations assigned. Only Vlans with 1 location will be considered for the sync.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@ def load_vlans(self):
"""
# TODO: update this to support multiple locations per VLAN after the setting for this feature has been added.
location_ids = list(self.job.devices_to_load.values_list("location__id", flat=True))
for vlan in VLAN.objects.filter(location__in=location_ids):
for vlan in VLAN.objects.filter(locations__in=location_ids):
if (
vlan.locations.count() > 1
): # TODO: A conditional check will be needed here to support multiple locations per VLAN
if self.job.debug:
self.job.logger.debug(
f"Vlan {vlan.name} has multiple locations. Skipping Vlan load for {vlan.name}."
)
continue
network_vlan = self.vlan(
adapter=self,
name=vlan.name,
Expand Down