-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added script to check for and delete packer cache
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|