1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Include HTTP error code when reporting an error while download appliance templates

from GitHub repository.
This commit is contained in:
grossmj 2018-08-21 17:30:34 +07:00
parent b7f9b865c8
commit 9ef23ce6a8

View File

@ -78,7 +78,7 @@ class Controller:
log.info("Appliance templates are already up-to-date (ETag {})".format(self._appliance_templates_etag)) log.info("Appliance templates are already up-to-date (ETag {})".format(self._appliance_templates_etag))
return return
elif response.status != 200: elif response.status != 200:
raise aiohttp.web.HTTPConflict(text="Could not retrieve appliance templates on GitHub") raise aiohttp.web.HTTPConflict(text="Could not retrieve appliance templates on GitHub due to HTTP error code {}".format(response.status))
etag = response.headers.get("ETag") etag = response.headers.get("ETag")
if etag: if etag:
self._appliance_templates_etag = etag self._appliance_templates_etag = etag
@ -92,7 +92,7 @@ class Controller:
log.info("Download appliance template file from '{}'".format(appliance["download_url"])) log.info("Download appliance template file from '{}'".format(appliance["download_url"]))
response = yield from session.get(appliance["download_url"]) response = yield from session.get(appliance["download_url"])
if response.status != 200: if response.status != 200:
log.warning("Could not download '{}'".format(appliance["download_url"])) log.warning("Could not download '{}' due to HTTP error code {}".format(appliance["download_url"], response.status))
continue continue
try: try:
appliance_data = yield from response.read() appliance_data = yield from response.read()