Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added script to check for and delete packer cache #24

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions edge/vmware/clone_vm_template/delete-packer-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

source /edge/vmware/clone_vm_template/setenv.sh

# Check if the packer cache exists
CACHE_EXISTS=$(govc datastore.ls -ds=$vcenter_datastore /packer_cache 2>&1)

if [ -z "$CACHE_EXISTS" ]; then
echo "Existing packer cache not found. Nothing to delete."
else
# Cache exists, attempt to delete it
govc datastore.rm -ds=$vcenter_datastore /packer_cache
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Deleted previous packer cache."
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
exit 0
else
echo "Failed to delete packer cache."
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi
fi

Loading