From 3cce61335cc90746f40b6962bfe4c4c09cb35972 Mon Sep 17 00:00:00 2001 From: karsten-adot <151919995+karsten-adot@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:57:35 +0100 Subject: [PATCH] fix: handle destroy with missing security group (#381) This PR makes the following changes: * Destroying cluser even if security group is missing (for example in case of ungraceful stop during a previous destroy) I tested this PR by hand and against incomplete cluster (missing security group) Co-authored-by: Nicholas Chammas --- flintrock/ec2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flintrock/ec2.py b/flintrock/ec2.py index 195781e..3006332 100644 --- a/flintrock/ec2.py +++ b/flintrock/ec2.py @@ -195,7 +195,10 @@ def destroy(self): region=self.region, cluster_name=self.name, ) - cluster_group.delete() + # Cluster group might already have been killed if a destroy was ungracefully stopped during + # a previous execution. + if cluster_group: + cluster_group.delete() (ec2.instances .filter(