mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-18 10:53:13 +09:00
bug #1345: Get size for marketplace URLS from image metadata
This commit is contained in:
1 parent
fa444a00d7
commit
2eab0ed9ce
1 file changed
+15
@@ -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=$?
|
||||
|
||||
Reference in new issue
Block a user