Skip to content

Commit

Permalink
chore: add logic for error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lennessyy committed Nov 21, 2023
1 parent 4416310 commit d2f7f6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions edge/vmware/clone_vm_template/delete-packer-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ if [ $? -ne 0 ]; then
fi

# Now, try to list the packer_cache directory
govc datastore.ls -ds=$vcenter_datastore /packer_cache
if [ $? -ne 0 ]; then
PACKER_CACHE_OUTPUT=$(govc datastore.ls -ds=$vcenter_datastore /packer_cache 2>&1)
PACKER_CACHE_STATUS=$?

if [ $PACKER_CACHE_STATUS -ne 0 ]; then
echo "Existing packer cache not found. Nothing to delete."
else
# Cache exists, attempt to delete it
Expand Down

0 comments on commit d2f7f6c

Please sign in to comment.