Skip to content

Commit a19f3e4

Browse files
hanwen-clusterhgreebe
authored andcommitted
Do not error exit when capacity reservation from the existing cluster config has been deleted
(cherry picked from commit 275a62e)
1 parent 07a86a4 commit a19f3e4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cli/src/pcluster/config/cluster_config.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,9 +2445,13 @@ def _instance_type_from_capacity_reservation(self):
24452445
self.capacity_reservation_target.capacity_reservation_id if self.capacity_reservation_target else None
24462446
)
24472447
if capacity_reservation_id:
2448-
capacity_reservations = AWSApi.instance().ec2.describe_capacity_reservations([capacity_reservation_id])
2449-
if capacity_reservations:
2450-
instance_type = capacity_reservations[0].instance_type()
2448+
try:
2449+
capacity_reservations = AWSApi.instance().ec2.describe_capacity_reservations([capacity_reservation_id])
2450+
if capacity_reservations:
2451+
instance_type = capacity_reservations[0].instance_type()
2452+
except AWSClientError:
2453+
# In case the CR has expired and we are unable to retrieve the instance type
2454+
instance_type = None
24512455
return instance_type
24522456

24532457

0 commit comments

Comments
 (0)