Make downstream issues show their error in the UI
This commit is contained in:
parent
fe6760749a
commit
9676d7d8c7
3 changed files with 5 additions and 4 deletions
|
@ -330,7 +330,8 @@ class RepositoryTrust(RepositoryParamResource):
|
||||||
|
|
||||||
tags, _ = tuf_metadata_api.get_default_tags_with_expiration(namespace, repository)
|
tags, _ = tuf_metadata_api.get_default_tags_with_expiration(namespace, repository)
|
||||||
if tags and not tuf_metadata_api.delete_metadata(namespace, repository):
|
if tags and not tuf_metadata_api.delete_metadata(namespace, repository):
|
||||||
raise DownstreamIssue({'message': 'Unable to delete downstream trust metadata'})
|
raise DownstreamIssue('Unable to delete downstream trust metadata')
|
||||||
|
|
||||||
values = request.get_json()
|
values = request.get_json()
|
||||||
model.set_trust(namespace, repository, values['trust_enabled'])
|
model.set_trust(namespace, repository, values['trust_enabled'])
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ def _security_status_for_image(namespace, repository, repo_image, include_vulner
|
||||||
else:
|
else:
|
||||||
data = secscan_api.get_layer_data(repo_image, include_features=True)
|
data = secscan_api.get_layer_data(repo_image, include_features=True)
|
||||||
except APIRequestFailure as arf:
|
except APIRequestFailure as arf:
|
||||||
raise DownstreamIssue({'message': arf.message})
|
raise DownstreamIssue(arf.message)
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
|
|
|
@ -129,5 +129,5 @@ class NotFound(ApiException):
|
||||||
|
|
||||||
|
|
||||||
class DownstreamIssue(ApiException):
|
class DownstreamIssue(ApiException):
|
||||||
def __init__(self, payload=None):
|
def __init__(self, error_description, payload=None):
|
||||||
ApiException.__init__(self, ApiErrorType.downstream_issue, 520, 'Downstream Issue', payload)
|
ApiException.__init__(self, ApiErrorType.downstream_issue, 520, error_description, payload)
|
||||||
|
|
Reference in a new issue