mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes: #15502 - Correct exception on IP import form when VM is target
This commit is contained in:
committed by
Jeremy Stretch
parent
bbd7ddb7aa
commit
7d54357146
@ -378,7 +378,7 @@ class IPAddressImportForm(NetBoxModelImportForm):
|
|||||||
|
|
||||||
# Set as primary for device/VM
|
# Set as primary for device/VM
|
||||||
if self.cleaned_data.get('is_primary'):
|
if self.cleaned_data.get('is_primary'):
|
||||||
parent = self.cleaned_data['device'] or self.cleaned_data['virtual_machine']
|
parent = self.cleaned_data.get('device') or self.cleaned_data.get('virtual_machine')
|
||||||
if self.instance.address.version == 4:
|
if self.instance.address.version == 4:
|
||||||
parent.primary_ip4 = ipaddress
|
parent.primary_ip4 = ipaddress
|
||||||
elif self.instance.address.version == 6:
|
elif self.instance.address.version == 6:
|
||||||
|
Reference in New Issue
Block a user