Skip to content

Commit f93d58c

Browse files
committed
1 parent dda439f commit f93d58c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clean-ci-resources.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ for resource in 'loadbalancer' 'server' 'router' 'subnet' 'network' 'volume snap
8282
volume)
8383
for r in $(./stale.sh -q "$resource"); do
8484
status=$(openstack "${resource}" show -c status -f value "${r}")
85+
attach_status=$(openstack "${resource}" show -c attachments -f value "${r}")
86+
if [ "$attach_status" != "[]" ]; then
87+
echo "${resource} ${r} is attached to a server, will try to detach it"
88+
openstack "${resource}" set --detached "$r" || >&2 echo "Failed to detach ${resource} ${r}, ${r} will probably fail to be removed..."
89+
fi
8590
case "$status" in
8691
# For Cinder volumes, deletable states are documented here:
8792
# https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=delete-a-volume-detail#delete-a-volume

0 commit comments

Comments
 (0)