Browse code

upload_image.sh should parse filenames correctly

The upload_image script gives the ability to the user to provide
specific metadata using the filename:
file-adapter_type;disk_type;network_type.vmdk
Currently, the regex expects each of these types to be populated.
This patch fixes this issue by making the regex more flexible and
accepts only one of these metadata to be populated.

Change-Id: If74cb06cc640864e7e91fd88943cdb37e05935d6
Closes-Bug: #1272126

Arnaud Legendre authored on 2014/01/24 10:12:21
Showing 1 changed files
... ...
@@ -1539,7 +1539,7 @@ function upload_image() {
1539 1539
         # NOTE: For backwards compatibility reasons, colons may be used in place
1540 1540
         # of semi-colons for property delimiters but they are not permitted
1541 1541
         # characters in NTFS filesystems.
1542
-        property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+[:;].+[:;].+$'`
1542
+        property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).*[:;].*[:;].*$'`
1543 1543
         IFS=':;' read -a props <<< "$property_string"
1544 1544
         vmdk_disktype="${props[0]:-$vmdk_disktype}"
1545 1545
         vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"