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>
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