creation tag
This commit is contained in:
@@ -35,8 +35,12 @@ class Vchassis_checker(Script):
|
|||||||
}
|
}
|
||||||
tag = Tag(**tag_data)
|
tag = Tag(**tag_data)
|
||||||
if commit:
|
if commit:
|
||||||
|
tag.full_clean()
|
||||||
tag.save()
|
tag.save()
|
||||||
self.log_success(f'Создан тег: {self.TAGS}')
|
self.log_success(
|
||||||
|
f'Создан тег: {self.TAGS}',
|
||||||
|
obj=tag,
|
||||||
|
)
|
||||||
vc = data['virtual_chassis']
|
vc = data['virtual_chassis']
|
||||||
devices: list[Device] = list(vc.members.all().order_by('vc_position'))
|
devices: list[Device] = list(vc.members.all().order_by('vc_position'))
|
||||||
if not vc._state.adding and vc.master and vc.master not in devices:
|
if not vc._state.adding and vc.master and vc.master not in devices:
|
||||||
@@ -45,6 +49,9 @@ class Vchassis_checker(Script):
|
|||||||
interfaces = Interface.objects.filter(device=device)
|
interfaces = Interface.objects.filter(device=device)
|
||||||
for iface in interfaces:
|
for iface in interfaces:
|
||||||
m = self.IFACE_RE.match(iface)
|
m = self.IFACE_RE.match(iface)
|
||||||
|
prefix = m.group('prefix')
|
||||||
|
slot = m.group('slot')
|
||||||
|
rest = m.group('rest')
|
||||||
|
|
||||||
# Все интерфейсы всех устройств стека одним запросом
|
# Все интерфейсы всех устройств стека одним запросом
|
||||||
device_ids = [d.pk for d in devices]
|
device_ids = [d.pk for d in devices]
|
||||||
@@ -68,10 +75,3 @@ class Vchassis_checker(Script):
|
|||||||
count = interfaces_qs.count()
|
count = interfaces_qs.count()
|
||||||
self.log_success(f'Будет обновлено интерфейсов: {count}')
|
self.log_success(f'Будет обновлено интерфейсов: {count}')
|
||||||
|
|
||||||
|
|
||||||
# vchassis = VirtualChassis.objects.all()
|
|
||||||
# for vc in vchassis:
|
|
||||||
# interfaces = Interface.objects.filter(device=vc)
|
|
||||||
# for interface in interfaces:
|
|
||||||
# interface.name = f'{vc.name}-{interface.name}'
|
|
||||||
# interface.save()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user