From: Nikos Skalkotos Date: Thu, 3 Oct 2013 12:30:09 +0000 (+0300) Subject: Change the local-backend identifier to local:// X-Git-Tag: 0.11~1^2~10 X-Git-Url: https://code.grnet.gr/git/snf-image/commitdiff_plain/0a982a6df8cda755e7ab2bc5a5947ca674d4eada Change the local-backend identifier to local:// This used to be file:// --- diff --git a/snf-image-host/common.sh.in b/snf-image-host/common.sh.in index 02e567c..5236c1c 100644 --- a/snf-image-host/common.sh.in +++ b/snf-image-host/common.sh.in @@ -50,6 +50,10 @@ log_error() { echo "[ERROR] $*" >&2 } +log_warning() { + echo "[WARNING] $*" >&2 +} + report_error() { ERROR_MSGS+=("$@") } diff --git a/snf-image-host/create b/snf-image-host/create index e302e26..f9fc7bc 100755 --- a/snf-image-host/create +++ b/snf-image-host/create @@ -56,7 +56,21 @@ trap report_and_cleanup EXIT case $BACKEND_TYPE in local) - image_file="$IMAGE_DIR/$(echo "$IMAGE_NAME" | sed 's/^file://').$IMAGE_TYPE" + if [[ "$IMAGE_NAME" =~ ^local:// ]]; then + IMAGE_NAME="${IMAGE_NAME:8}" + elif [[ "$IMAGE_NAME" =~ ^file:// ]]; then + IMAGE_NAME="${IMAGE_NAME:7}" + log_warning "The file:// back-end identifier is deprecated and " \ + "will be removed in the future. Use local:// instead." + fi + + if [ "$IMAGE_NAME" != "${IMAGE_NAME##*/}" ]; then + report_error "Image id is not allowed to contain /'s" + log_error "Image id is not allowed to contain /'s" + exit 1 + fi + + image_file="$IMAGE_DIR/$IMAGE_NAME.$IMAGE_TYPE" if [ ! -e "$image_file" ]; then log_error "Image file \`$image_file' does not exit." report_error "Unable to retrieve image file."