Fix a crash when missing rack id #172

Merged
cyrinux merged 6 commits from fix_a_crash into master 2021-07-20 21:55:47 +02:00
2 changed files with 2 additions and 3 deletions
Showing only changes of commit 225286ed46 - Show all commits

View file

@ -1,7 +1,5 @@
import logging
import subprocess
import logging
from netbox_agent.misc import is_tool
from netbox_agent.misc import is_tool

View file

@ -81,7 +81,8 @@ class ServerBase():
if (
rack
and all(map(lambda x: x is not None and "id" in x, (nb_rack, server.rack)))
and server.rack
and nb_rack
and server.rack.id != nb_rack.id
):
logging.info('Rack location has changed from {} to {}, updating'.format(