Revision 9cd69cad

b/snf-image-host/create
60 60
            IMAGE_NAME="${IMAGE_NAME:8}"
61 61
        elif [[ "$IMAGE_NAME" =~ ^file:// ]]; then
62 62
            IMAGE_NAME="${IMAGE_NAME:7}"
63
            log_warning "The file:// back-end identifier is deprecated and " \
63
            log_warning "The file:// back-end identifier is deprecated and" \
64 64
                        "will be removed in the future. Use local:// instead."
65 65
        fi
66 66

  
......
70 70
            report_error "Unable to retrieve image file."
71 71
        fi
72 72

  
73
        image_file="$IMAGE_DIR/$IMAGE_NAME.$IMAGE_TYPE"
74
        canonical_image_file="$(canonicalize "$image_file")"
75

  
76
        if [ ! -e "$canonical_image_file" ]; then
77
            log_error "Image file \`$image_file' does not exist."
78
            report_error "Unable to retrieve image file."
79
            exit 1
73
        image_file="$IMAGE_DIR/$IMAGE_NAME"
74
        if [ ! -e "$image_file" ]; then
75
            if [ -e "$image_file.$IMAGE_TYPE" ] ; then
76
                image_file="$image_file.$IMAGE_TYPE"
77
                log_warning "The \`.$IMAGE_TYPE' extension is missing from" \
78
                    "the local back-end id. This id form is deprecated and" \
79
                    " will be remove in the future."
80
            else
81
                log_error "Image file \`$image_file' does not exist."
82
                report_error "Unable to retrieve image file."
83
                exit 1
84
            fi
80 85
        fi
81 86

  
87
        canonical_image_file="$(canonicalize "$image_file")"
88

  
82 89
        if [[ "$canonical_image_file" != "$canonical_image_dir"* ]]; then
83 90
            log_error "Image ID points to a file outside the image directory: \`$IMAGE_DIR'"
84 91
            report_error "Invalid image ID"

Also available in: Unified diff