File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -70,17 +70,28 @@ jobs:
7070 # Get all servers with the matching name for control node
7171 CONTROL_SERVERS=$(openstack server list --name ${cluster_prefix}-control --format json)
7272 SERVER_COUNT=$(echo "$CONTROL_SERVERS" | jq length)
73-
73+
7474 if [[ $SERVER_COUNT -gt 1 ]]; then
75- echo "Warning: More than one server found for control node '${cluster_prefix}-control'."
76- continue
77- fi
78- TAGS=$(echo "$CONTROL_SERVERS" | jq -r '.[0].Tags' )
79-
80- if [[ $TAGS =~ "keep" ]]; then
81- echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
75+ echo "Multiple servers found for control node '${cluster_prefix}-control'. Checking tags for each..."
76+
77+ for server in $(echo "$CONTROL_SERVERS" | jq -r '.[].ID'); do
78+ # Get tags for each control node
79+ TAGS=$(openstack server show "$server" --column tags --format value)
80+
81+ if [[ $TAGS =~ "keep" ]]; then
82+ echo "Skipping ${cluster_prefix} (server ${server}) - control instance is tagged as keep"
83+ else
84+ ./dev/delete-cluster.py ${cluster_prefix} --force
85+ fi
86+ done
8287 else
83- ./dev/delete-cluster.py ${cluster_prefix} --force
88+ # If only one server, extract its tags and proceed
89+ TAGS=$(echo "$CONTROL_SERVERS" | jq -r '.[0].Tags')
90+ if [[ $TAGS =~ "keep" ]]; then
91+ echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
92+ else
93+ ./dev/delete-cluster.py ${cluster_prefix} --force
94+ fi
8495 fi
8596 done
8697 shell : bash
You can’t perform that action at this time.
0 commit comments