Fix vyos url and check all urls

Fix #30
This commit is contained in:
Julien Duponchelle 2015-10-13 18:43:20 +02:00
parent 5764ba1cde
commit 967fc71862
2 changed files with 23 additions and 9 deletions

View File

@ -7,7 +7,7 @@
"documentation_url": "http://vyos.net/wiki/User_Guide",
"product_name": "VyOS",
"product_url": "http://vyos.net/",
"registry_version": 1,
"registry_version": 1,
"status": "stable",
"maintainer": "GNS3 Team",
"maintainer_email": "developers@gns3.net",
@ -29,14 +29,16 @@
"version": "1.1.6",
"md5sum": "3128954d026e567402a924c2424ce2bf",
"filesize": 245366784,
"download_url": "http://mirror.vyos.net/iso/release/1.1.6/vyos-1.16-amd64.iso"
"download_url": "http://mirror.vyos.net/iso/release/1.1.6/",
"direct_download_url": "http://mirror.vyos.net/iso/release/1.1.6/vyos-1.1.6-amd64.iso"
},
{
"filename": "vyos-1.1.5-amd64.iso",
"version": "1.1.5",
"md5sum": "193179532011ceaa87ee725bd8f22022",
"filesize": 247463936,
"download_url": "http://mirror.vyos.net/iso/release/1.1.5/vyos-1.1.5-amd64.iso"
"download_url": "http://mirror.vyos.net/iso/release/1.1.5/",
"direct_download_url": "http://mirror.vyos.net/iso/release/1.1.5/vyos-1.1.5-amd64.iso"
},
{
"filename": "empty8G.qcow2",

View File

@ -23,6 +23,15 @@ import subprocess
import urllib.request
def check_url(url, appliance):
try:
req = urllib.request.Request(url, method='HEAD')
urllib.request.urlopen(req)
except (urllib.error.HTTPError, urllib.error.URLError):
print('Error with url ' + url + ' in appliance ' + appliance)
sys.exit(1)
def check_appliance(appliance):
global images
images = set()
@ -46,12 +55,15 @@ def check_appliance(appliance):
images.add(image['filename'])
md5sums.add(image['md5sum'])
if 'direct_download_url' in image:
try:
req = urllib.request.Request(image['direct_download_url'], method='HEAD')
urllib.request.urlopen(req)
except (urllib.error.HTTPError, urllib.error.URLError):
print('File error ' + image['direct_download_url'])
sys.exit(1)
check_url(image['direct_download_url'], appliance)
if 'download_url' in image:
check_url(image['download_url'], appliance)
if 'vendor_url' in image:
check_url(image['vendor_url'], appliance)
if 'documentation_url' in image:
check_url(image['documentation_url'], appliance)
if 'product_url' in image:
check_url(image['product_url'], appliance)
for version in appliance_json['versions']:
for image in version['images'].values():