1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

bug #1345: Get size for marketplace URLS from image metadata

This commit is contained in:
Ruben S. Montero 2012-09-14 23:59:07 +02:00
parent fa444a00d7
commit 2eab0ed9ce

View File

@ -91,6 +91,21 @@ EOF
function fs_size {
case $1 in
http://*/download|https://*/download)
BASE_URL=${1%%/download}
HEADERS=`wget -S --spider --no-check-certificate $BASE_URL 2>&1`
echo $HEADERS | grep "opennebula_marketplace" > /dev/null 2>&1
if [ $? -eq 0 ]; then
#URL is from market place
SIZE=`wget -O - -S --no-check-certificate $BASE_URL 2>&1 | grep size | cut -d: -f2`
else
#Not a marketplace URL
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
fi
error=$?
;;
http://*|https://*)
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
error=$?