From b93cd643432d3633c48bec02fcd7cb4f354f67ed Mon Sep 17 00:00:00 2001 From: Arnaud Legendre Date: Thu, 23 Jan 2014 17:12:21 -0800 Subject: [PATCH] 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 --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 92b61ed974..276cea1e04 100644 --- a/functions +++ b/functions @@ -1539,7 +1539,7 @@ function upload_image() { # NOTE: For backwards compatibility reasons, colons may be used in place # of semi-colons for property delimiters but they are not permitted # characters in NTFS filesystems. - property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+[:;].+[:;].+$'` + property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).*[:;].*[:;].*$'` IFS=':;' read -a props <<< "$property_string" vmdk_disktype="${props[0]:-$vmdk_disktype}" vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"