From 00b9c9bb553b9cb72ca2d9b37ed9c63c025f6842 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 2 Apr 2023 09:23:18 -0400 Subject: [PATCH] Check for base VM in default project; rm if exists --- create_lxc_base.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/create_lxc_base.sh b/create_lxc_base.sh index ca48938..6d1b1ad 100755 --- a/create_lxc_base.sh +++ b/create_lxc_base.sh @@ -5,6 +5,10 @@ cd "$(dirname "$0")" bash -c "./stub_lxc_profile.sh --lxd-hostname=$BASE_IMAGE_VM_NAME" +if lxc list -q --project default | grep -q "$BASE_IMAGE_VM_NAME" ; then + lxc delete -f "$BASE_IMAGE_VM_NAME" --project=default +fi + # let's download our base image. if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then # if the image if cached locally, import it from disk, otherwise download it from ubuntu