File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
nautobot_device_onboarding/diffsync/adapters Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
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 @@ -138,7 +138,15 @@ def load_vlans(self):
138
138
"""
139
139
# TODO: update this to support multiple locations per VLAN after the setting for this feature has been added.
140
140
location_ids = list (self .job .devices_to_load .values_list ("location__id" , flat = True ))
141
- for vlan in VLAN .objects .filter (location__in = location_ids ):
141
+ for vlan in VLAN .objects .filter (locations__in = location_ids ):
142
+ if (
143
+ vlan .locations .count () > 1
144
+ ): # TODO: A conditional check will be needed here to support multiple locations per VLAN
145
+ if self .job .debug :
146
+ self .job .logger .debug (
147
+ f"Vlan { vlan .name } has multiple locations. Skipping Vlan load for { vlan .name } ."
148
+ )
149
+ continue
142
150
network_vlan = self .vlan (
143
151
adapter = self ,
144
152
name = vlan .name ,
You can’t perform that action at this time.
0 commit comments