Refactor vmdk upload code
A syntax error is hit when trying to upload a flat vmdk file that is accompanied by a descriptor file. The code block that handles this has some unneeded characters that cause the error. Also, an else-block has been removed so that we can remove an extra indent. Change-Id: Iaf5c914e09da6831eeeec141228b39554a1e2216 Closes-bug: #1288471
This commit is contained in:
parent
4981bd7532
commit
99b622a936
@ -163,7 +163,8 @@ function upload_image {
|
|||||||
if [[ ${IMAGE_NAME: -5} != "-flat" ]]; then
|
if [[ ${IMAGE_NAME: -5} != "-flat" ]]; then
|
||||||
warn $LINENO "Expected filename suffix: '-flat'."`
|
warn $LINENO "Expected filename suffix: '-flat'."`
|
||||||
`" Filename provided: ${IMAGE_NAME}"
|
`" Filename provided: ${IMAGE_NAME}"
|
||||||
else
|
fi
|
||||||
|
|
||||||
descriptor_fname="${IMAGE_NAME:0:${#IMAGE_NAME} - 5}.vmdk"
|
descriptor_fname="${IMAGE_NAME:0:${#IMAGE_NAME} - 5}.vmdk"
|
||||||
path_len=`expr ${#image_url} - ${#IMAGE_FNAME}`
|
path_len=`expr ${#image_url} - ${#IMAGE_FNAME}`
|
||||||
flat_path="${image_url:0:$path_len}"
|
flat_path="${image_url:0:$path_len}"
|
||||||
@ -189,12 +190,10 @@ function upload_image {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if $descriptor_found; then
|
if $descriptor_found; then
|
||||||
vmdk_adapter_type="$(head -25 $descriptor_url |"`
|
vmdk_adapter_type="$(head -25 $descriptor_url | { grep -a -F -m 1 'ddb.adapterType =' $descriptor_url || true; })"
|
||||||
`" { grep -a -F -m 1 'ddb.adapterType =' $descriptor_url || true; })"
|
|
||||||
vmdk_adapter_type="${vmdk_adapter_type#*\"}"
|
vmdk_adapter_type="${vmdk_adapter_type#*\"}"
|
||||||
vmdk_adapter_type="${vmdk_adapter_type%?}"
|
vmdk_adapter_type="${vmdk_adapter_type%?}"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
vmdk_disktype="preallocated"
|
vmdk_disktype="preallocated"
|
||||||
else
|
else
|
||||||
vmdk_disktype="preallocated"
|
vmdk_disktype="preallocated"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user