diff --git a/netbox_agent/server.py b/netbox_agent/server.py index a5774de..6e36d8e 100644 --- a/netbox_agent/server.py +++ b/netbox_agent/server.py @@ -79,7 +79,11 @@ class ServerBase(): update = True server.site = nb_dc.id - if rack and all(map(lambda x: x is not None and "id" in x, (nb_rack, server.rack))) and server.rack.id != nb_rack.id: + if ( + rack + and all(map(lambda x: x is not None and "id" in x, (nb_rack, server.rack))) + and server.rack.id != nb_rack.id + ): logging.info('Rack location has changed from {} to {}, updating'.format( server.rack, nb_rack,