fix add interface
This commit is contained in:
@@ -52,7 +52,6 @@ class Vchassis_checker(Script):
|
|||||||
interfaces_qs = Interface.objects.filter(
|
interfaces_qs = Interface.objects.filter(
|
||||||
device_id__in=device_ids
|
device_id__in=device_ids
|
||||||
).select_related("device")
|
).select_related("device")
|
||||||
|
|
||||||
to_update = []
|
to_update = []
|
||||||
for iface in interfaces_qs:
|
for iface in interfaces_qs:
|
||||||
m = self.IFACE_RE.match(iface.name)
|
m = self.IFACE_RE.match(iface.name)
|
||||||
@@ -61,6 +60,7 @@ class Vchassis_checker(Script):
|
|||||||
slot = m.group("slot")
|
slot = m.group("slot")
|
||||||
rest = m.group("rest")
|
rest = m.group("rest")
|
||||||
iface.name = f"{prefix}{iface.device.vc_position}/{rest}"
|
iface.name = f"{prefix}{iface.device.vc_position}/{rest}"
|
||||||
|
to_update.append(iface)
|
||||||
if commit:
|
if commit:
|
||||||
Interface.objects.bulk_update(to_update, fields=["name"], batch_size=100)
|
Interface.objects.bulk_update(to_update, fields=["name"], batch_size=100)
|
||||||
vc.tags.add(tag)
|
vc.tags.add(tag)
|
||||||
|
|||||||
Reference in New Issue
Block a user