log response data on non-200 responses in TUF API
This commit is contained in:
parent
ac328da383
commit
b545cad380
1 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ class Non200ResponseException(Exception):
|
||||||
|
|
||||||
|
|
||||||
class TUFMetadataAPI(object):
|
class TUFMetadataAPI(object):
|
||||||
""" Helper class for talking to the Security Scan service (usually Clair). """
|
""" Helper class for talking to the TUF Metadata service (Apostille). """
|
||||||
def __init__(self, app, config, client=None):
|
def __init__(self, app, config, client=None):
|
||||||
feature_enabled = config.get('FEATURE_SIGNING', False)
|
feature_enabled = config.get('FEATURE_SIGNING', False)
|
||||||
if feature_enabled:
|
if feature_enabled:
|
||||||
|
@ -202,7 +202,7 @@ class ImplementedTUFMetadataAPI(TUFMetadataAPIInterface):
|
||||||
logger.exception('Failed to delete metadata for %s', gun)
|
logger.exception('Failed to delete metadata for %s', gun)
|
||||||
return False
|
return False
|
||||||
except Non200ResponseException as ex:
|
except Non200ResponseException as ex:
|
||||||
logger.exception('Failed request for %s: %s', gun, str(ex))
|
logger.exception('Failed request for %s: %s %s', gun, ex.response, str(ex))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class ImplementedTUFMetadataAPI(TUFMetadataAPIInterface):
|
||||||
except (requests.exceptions.RequestException, ValueError):
|
except (requests.exceptions.RequestException, ValueError):
|
||||||
logger.exception('Failed to get metadata for %s', gun)
|
logger.exception('Failed to get metadata for %s', gun)
|
||||||
except Non200ResponseException as ex:
|
except Non200ResponseException as ex:
|
||||||
logger.exception('Failed request for %s: %s', gun, str(ex))
|
logger.exception('Failed request for %s: %s %s', gun, ex.response, str(ex))
|
||||||
except InvalidMetadataException as ex:
|
except InvalidMetadataException as ex:
|
||||||
logger.exception('Failed to parse targets from metadata: %s', str(ex))
|
logger.exception('Failed to parse targets from metadata: %s', str(ex))
|
||||||
return None
|
return None
|
||||||
|
|
Reference in a new issue