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