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 | ae15c9c6702ec5e8af44d72c5a37eaefee27a0d8 (patch) | |
tree | cf646289eb446303e5be4e82c241c3c75e29f9cc /src | |
parent | 4816475aecde4d949e1a4d37b4f494573d7257bd (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 'src')
-rw-r--r-- | src/resource_inventory/pdf_templater.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/resource_inventory/pdf_templater.py b/src/resource_inventory/pdf_templater.py index 9f7e7f1..a50f04c 100644 --- a/src/resource_inventory/pdf_templater.py +++ b/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 |