diff --git a/netbox_agent/server.py b/netbox_agent/server.py index 68db8da..9cedf62 100644 --- a/netbox_agent/server.py +++ b/netbox_agent/server.py @@ -66,7 +66,6 @@ class ServerBase(): def update_netbox_location(self, server): dc = self.get_datacenter() - rack = self.get_rack() nb_rack = self.get_netbox_rack() nb_dc = self.get_netbox_datacenter() @@ -79,7 +78,11 @@ class ServerBase(): update = True server.site = nb_dc.id - if rack and server.rack and server.rack.id != nb_rack.id: + if ( + server.rack + and nb_rack + and server.rack.id != nb_rack.id + ): logging.info('Rack location has changed from {} to {}, updating'.format( server.rack, nb_rack,