diff --git a/endpoints/api/repository.py b/endpoints/api/repository.py index a782018ea..c76dffd99 100644 --- a/endpoints/api/repository.py +++ b/endpoints/api/repository.py @@ -330,7 +330,8 @@ class RepositoryTrust(RepositoryParamResource): tags, _ = tuf_metadata_api.get_default_tags_with_expiration(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() model.set_trust(namespace, repository, values['trust_enabled']) diff --git a/endpoints/api/secscan.py b/endpoints/api/secscan.py index 3929a2e2b..3fd04a66d 100644 --- a/endpoints/api/secscan.py +++ b/endpoints/api/secscan.py @@ -47,7 +47,7 @@ def _security_status_for_image(namespace, repository, repo_image, include_vulner else: data = secscan_api.get_layer_data(repo_image, include_features=True) except APIRequestFailure as arf: - raise DownstreamIssue({'message': arf.message}) + raise DownstreamIssue(arf.message) if data is None: raise NotFound() diff --git a/endpoints/exception.py b/endpoints/exception.py index 537f3f167..abc32cc54 100644 --- a/endpoints/exception.py +++ b/endpoints/exception.py @@ -129,5 +129,5 @@ class NotFound(ApiException): class DownstreamIssue(ApiException): - def __init__(self, payload=None): - ApiException.__init__(self, ApiErrorType.downstream_issue, 520, 'Downstream Issue', payload) + def __init__(self, error_description, payload=None): + ApiException.__init__(self, ApiErrorType.downstream_issue, 520, error_description, payload)