1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge branch 'develop-2.10' into 4878-custom-fields

This commit is contained in:
Jeremy Stretch
2020-09-04 16:14:06 -04:00
47 changed files with 465 additions and 118 deletions

View File

@ -325,13 +325,13 @@ class VirtualMachine(ChangeLoggedModel, ConfigContextModel, CustomFieldModel):
for field in ['primary_ip4', 'primary_ip6']:
ip = getattr(self, field)
if ip is not None:
if ip.interface in interfaces:
if ip.assigned_object in interfaces:
pass
elif self.primary_ip4.nat_inside is not None and self.primary_ip4.nat_inside.interface in interfaces:
elif ip.nat_inside is not None and ip.nat_inside.assigned_object in interfaces:
pass
else:
raise ValidationError({
field: "The specified IP address ({}) is not assigned to this VM.".format(ip),
field: f"The specified IP address ({ip}) is not assigned to this VM.",
})
def to_csv(self):