Added a prompt to create a volume for an unknown account.

This commit is contained in:
2025-12-15 08:17:58 +01:00
parent f2be3898ff
commit a40a96e662

View File

@@ -76,6 +76,12 @@ fi
# Check, if the account volume exists, if not create it # Check, if the account volume exists, if not create it
# This ensures persistent storage for the Azure CLI configuration # This ensures persistent storage for the Azure CLI configuration
if ! $CMD volume inspect "account_$SANITIZED_ACCOUNT_NAME" &> /dev/null; then if ! $CMD volume inspect "account_$SANITIZED_ACCOUNT_NAME" &> /dev/null; then
echo "A volume for account '$ACCOUNT_NAME' does not exist."
read -p "Would you like to create one? (y/n) " -r RESPONSE
if [[ ! "$RESPONSE" =~ ^[Yy]$ ]]; then
echo "Aborting."
exit 1
fi
echo "Creating volume account_$SANITIZED_ACCOUNT_NAME for Azure CLI configuration." echo "Creating volume account_$SANITIZED_ACCOUNT_NAME for Azure CLI configuration."
if ! $CMD volume create "account_$SANITIZED_ACCOUNT_NAME" --label "account=$ACCOUNT_NAME" &> /dev/null; then if ! $CMD volume create "account_$SANITIZED_ACCOUNT_NAME" --label "account=$ACCOUNT_NAME" &> /dev/null; then
echo "Error: Failed to create volume account_$SANITIZED_ACCOUNT_NAME." >&2 echo "Error: Failed to create volume account_$SANITIZED_ACCOUNT_NAME." >&2