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 @@ -2410,9 +2410,13 @@ def _instance_type_from_capacity_reservation(self):
2410
2410
self .capacity_reservation_target .capacity_reservation_id if self .capacity_reservation_target else None
2411
2411
)
2412
2412
if capacity_reservation_id :
2413
- capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2414
- if capacity_reservations :
2415
- instance_type = capacity_reservations [0 ].instance_type ()
2413
+ try :
2414
+ capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2415
+ if capacity_reservations :
2416
+ instance_type = capacity_reservations [0 ].instance_type ()
2417
+ except AWSClientError :
2418
+ # In case the CR has expired and we are unable to retrieve the instance type
2419
+ instance_type = None
2416
2420
return instance_type
2417
2421
2418
2422
You can’t perform that action at this time.
0 commit comments