Some fixes that prevent crash on register and update (#128)

This commit is contained in:
Cyrinux 2020-06-08 14:16:50 +02:00 committed by GitHub
parent 28fc87c9e2
commit 9dedbea47a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -438,8 +438,8 @@ class ServerNetwork(Network):
self.server = server
self.device = self.server.get_netbox_server()
self.nb_net = nb.dcim
self.custom_arg = {'device': self.device.id}
self.custom_arg_id = {'device_id': self.device.id}
self.custom_arg = {'device': getattr(self.device, "id", None)}
self.custom_arg_id = {'device_id': getattr(self.device, "id", None)}
def get_network_type(self):
return 'server'
@ -558,8 +558,8 @@ class VirtualNetwork(Network):
self.server = server
self.device = self.server.get_netbox_vm()
self.nb_net = nb.virtualization
self.custom_arg = {'virtual_machine': self.device.id}
self.custom_arg_id = {'virtual_machine_id': self.device.id}
self.custom_arg = {'virtual_machine': getattr(self.device, "id", None)}
self.custom_arg_id = {'virtual_machine_id': getattr(self.device, "id", None)}
dcim_c = nb.virtualization.interfaces.choices()
for _choice_type in dcim_c: