Support SNI in python requests, and only delete tuf metadata if it

exists
This commit is contained in:
Evan Cordell 2017-05-01 15:51:54 -04:00
parent 02c4d75634
commit b2569ffbb2
6 changed files with 12 additions and 8 deletions

View file

@ -498,10 +498,11 @@ class RepositoryTrust(RepositoryParamResource):
repo = model.repository.get_repository(namespace, repository)
if not repo:
raise NotFound()
if not tuf_metadata_api.delete_metadata(namespace, repository):
raise DownstreamIssue({'message': 'Unable to delete downstream trust metadata'})
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'})
values = request.get_json()
model.repository.set_trust(repo, values['trust_enabled'])