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 @@ -2443,9 +2443,13 @@ def _instance_type_from_capacity_reservation(self):
2443
2443
self .capacity_reservation_target .capacity_reservation_id if self .capacity_reservation_target else None
2444
2444
)
2445
2445
if capacity_reservation_id :
2446
- capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2447
- if capacity_reservations :
2448
- instance_type = capacity_reservations [0 ].instance_type ()
2446
+ try :
2447
+ capacity_reservations = AWSApi .instance ().ec2 .describe_capacity_reservations ([capacity_reservation_id ])
2448
+ if capacity_reservations :
2449
+ instance_type = capacity_reservations [0 ].instance_type ()
2450
+ except AWSClientError :
2451
+ # In case the CR has expired and we are unable to retrieve the instance type
2452
+ instance_type = None
2449
2453
return instance_type
2450
2454
2451
2455
You can’t perform that action at this time.
0 commit comments