diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-03-25 14:07:15 -0400 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2019-03-25 14:07:15 -0400 |
commit | a296d84e3879465048a78b27ff4a1a253c405c65 (patch) | |
tree | 183afd4ecb4dda4c25bc56940d7051ec0aaf2f45 /dashboard | |
parent | de9c15c2237c57a5e23cdecae548a7a762004a4c (diff) |
Allow query to fail
Query for interface speed when templating the pdf may fail.
If it does fail, we provide a default value instead of aborting.
Change-Id: Ib3d6ddca7dd055e4066fb4915d33f6f9ad73ca80
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'dashboard')
-rw-r--r-- | dashboard/src/resource_inventory/pdf_templater.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dashboard/src/resource_inventory/pdf_templater.py b/dashboard/src/resource_inventory/pdf_templater.py index 9f7e7f1..a50f04c 100644 --- a/dashboard/src/resource_inventory/pdf_templater.py +++ b/dashboard/src/resource_inventory/pdf_templater.py @@ -154,8 +154,13 @@ class PDFTemplater: iface_info['features'] = "none" iface_info['mac_address'] = interface.mac_address iface_info['name'] = interface.name - profile = InterfaceProfile.objects.get(host=interface.host.profile, name=interface.name) - iface_info['speed'] = str(int(profile.speed / 1000)) + "gb" + speed = "unknown" + try: + profile = InterfaceProfile.objects.get(host=interface.host.profile, name=interface.name) + speed = str(int(profile.speed / 1000)) + "gb" + except Exception: + pass + iface_info['speed'] = speed return iface_info @classmethod |