Skip to content

Commit 5096ac8

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 afe8b12 commit 5096ac8

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
@@ -2443,9 +2443,13 @@ def _instance_type_from_capacity_reservation(self):
24432443
self.capacity_reservation_target.capacity_reservation_id if self.capacity_reservation_target else None
24442444
)
24452445
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
24492453
return instance_type
24502454

24512455

0 commit comments

Comments
 (0)