File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2408,9 +2408,13 @@ def _instance_type_from_capacity_reservation(self):
2408
2408
self .capacity_reservation_target .capacity_reservation_id if self .capacity_reservation_target else None
2409
2409
)
2410
2410
if capacity_reservation_id :
2411
- capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2412
- if capacity_reservations :
2413
- instance_type = capacity_reservations [0 ].instance_type ()
2411
+ try :
2412
+ capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2413
+ if capacity_reservations :
2414
+ instance_type = capacity_reservations [0 ].instance_type ()
2415
+ except AWSClientError :
2416
+ # In case the CR has expired and we are unable to retrieve the instance type
2417
+ instance_type = None
2414
2418
return instance_type
2415
2419
2416
2420
You can’t perform that action at this time.
0 commit comments