Commit 1f31677b authored by Morten Brekkevold's avatar Morten Brekkevold

forbedret printing av feilmeldinger ved post av nye objekter

Viste seg vanskelig å debugge disse feilene mot en testserver :)
parent 34d9fbcd
......@@ -396,9 +396,19 @@ def insert_one_into_nav(nav_api, kind_device):
nav_api.get_room(kind_device.room)
except ObjectNotFound:
room = dict(id=kind_device.room, location=DEFAULT_LOCATION)
nav_api.post_room(room)
try:
nav_api.post_room(room)
except requests.HTTPError as error:
LOG.error("Room post feilet for %s. Feilrespons: %s",
kind_device.room, error.response.content.decode())
raise
nav_api.post_netbox(netbox)
try:
nav_api.post_netbox(netbox)
except requests.HTTPError as error:
LOG.error("Netbox post feilet for %s. Feilrespons: %s",
netbox.get('sysname'), error.response.content.decode())
raise
def update_existing_in_nav(nav_api, kind_devices):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment