Skip to content

Commit e0099b5

Browse files
authored
Improve cleaning (#1375)
Avoid some errors that could cause trouble when cleaning the environment.
1 parent 4a68d47 commit e0099b5

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

ocp_cleanup.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ source validation.sh
99

1010
early_cleanup_validation
1111

12-
sudo systemctl stop fix_certs.timer
12+
if sudo systemctl is-active fix_certs.timer; then
13+
sudo systemctl stop fix_certs.timer
14+
fi
1315

1416
if [ -d ${OCP_DIR} ]; then
1517
${OCP_DIR}/openshift-install --dir ${OCP_DIR} --log-level=debug destroy bootstrap
@@ -56,10 +58,14 @@ if [ -d /var/lib/libvirt/openshift-images ]; then
5658
sudo rm -fr /var/lib/libvirt/openshift-images/${CLUSTER_NAME}-*
5759
fi
5860

59-
VOLS=$(sudo virsh vol-list --pool default | awk '{print $1}' | grep -e "^${CLUSTER_NAME}.*bootstrap" -e "^configdrive-" -e "^boot-.*-iso-")
60-
for v in $VOLS; do
61-
sudo virsh vol-delete $v --pool default
62-
done
61+
VOLS=$(sudo virsh vol-list --pool default | awk '{print $1}' | grep -e "^${CLUSTER_NAME}.*bootstrap" -e "^configdrive-" -e "^boot-.*-iso-") || true
62+
63+
if [ -n $VOLS ]; then
64+
for v in $VOLS; do
65+
sudo virsh vol-delete $v --pool default
66+
done
67+
fi
68+
6369

6470
if [ -d assets/generated ]; then
6571
rm -rf assets/generated

registry_cleanup.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ source validation.sh
77

88
early_cleanup_validation
99

10-
sudo podman kill registry
11-
sudo podman rm registry
10+
if sudo podman container exists registry; then
11+
sudo podman kill registry
12+
sudo podman rm registry
13+
fi
1214

1315
sudo rm -rf $WORKING_DIR/registry

0 commit comments

Comments
 (0)