Skip to content

Commit 74c93b2

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 10b30ce commit 74c93b2

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
@@ -2410,9 +2410,13 @@ def _instance_type_from_capacity_reservation(self):
24102410
self.capacity_reservation_target.capacity_reservation_id if self.capacity_reservation_target else None
24112411
)
24122412
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
24162420
return instance_type
24172421

24182422

0 commit comments

Comments
 (0)