Skip to content

Commit

Permalink
fix: added script to check for and delete packer cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lennessyy committed Nov 13, 2023
1 parent d36527f commit d2a776a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 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,20 @@
#!/bin/bas

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>/dev/null)

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."
else
echo "Failed to delete packer cache."
fi
fi

0 comments on commit d2a776a

Please sign in to comment.