1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00

framework/getters: Ignore connection errors with HTTP getter

If the http getter is used but a connection is not avalible, when
attempting to fetch the resource index an error will be raised. Now we
ignore the error allowing for the remaining getters to be used.
This commit is contained in:
Marc Bonnici 2018-03-31 19:51:55 +01:00 committed by setrofim
parent 5a67aabcbd
commit cf4ec25615

View File

@ -203,7 +203,7 @@ class Http(ResourceGetter):
def __init__(self, **kwargs):
super(Http, self).__init__(**kwargs)
self.logger = logger
self.index = None
self.index = {}
def register(self, resolver):
resolver.register(self.get, SourcePriority.remote)
@ -212,7 +212,12 @@ class Http(ResourceGetter):
if not resource.owner:
return # TODO: add support for unowned resources
if not self.index:
self.index = self.fetch_index()
try:
self.index = self.fetch_index()
except requests.exceptions.RequestException as e:
msg = 'Skipping HTTP getter due to connection error: {}'
self.logger.debug(msg.format(e.message))
return
if resource.kind == 'apk':
# APKs must always be downloaded to run ApkInfo for version
# information.