Skip to content

Commit 8e33d03

Browse files
committed
handle unattached hardware reservations
This is currently failing with: ``` TypeError: 'NoneType' object is not subscriptable ``` Signed-off-by: Adam Bozanich <[email protected]>
1 parent a2c8098 commit 8e33d03

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packet/HardwareReservation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def __init__(self, data, manager):
4444
# except (KeyError, IndexError):
4545
# self.attached_to = None
4646

47+
48+
# not attached
49+
if data["device"] is None:
50+
self.attached_to = None
51+
return
52+
4753
try:
4854
device_data = self.manager.call_api(data["device"]["href"], type="GET")
4955
self.device = Device(device_data, self.manager)

0 commit comments

Comments
 (0)