Skip to content

Commit 113be28

Browse files
committed
Enhance manual machine cleanup script
The updated script ensures that the systemd service files for juju are always deleted. Additionally, the script also detects and cleans up the juju-db snap if installed (2.8+).
1 parent d84e4ec commit 113be28

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cloudconfig/userdatacfg_unix.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ for path_to_unit in $(ls /etc/systemd/system/juju*); do
7676
systemctl stop "$unit"
7777
systemctl disable "$unit"
7878
systemctl daemon-reload
79+
rm -f "$path_to_unit"
7980
done
8081
8182
echo "removing /var/lib/juju/db/*"
@@ -86,6 +87,12 @@ rm -rf /var/lib/juju/raft/*
8687
8788
echo "removing /var/run/juju/*"
8889
rm -rf /var/run/juju/*
90+
91+
has_juju_db_snap=$(snap info juju-db | grep installed)
92+
if [ ! -z "$has_juju_db_snap" ]; then
93+
echo "removing juju-db snap and any persisted database data"
94+
snap remove --purge juju-db
95+
fi
8996
`
9097
)
9198

0 commit comments

Comments
 (0)