Catch an error when trying to generate an access token.
This commit is contained in:
parent
2e9f7cd19d
commit
3187539509
1 changed files with 8 additions and 4 deletions
|
@ -33,10 +33,14 @@ def generate_headers(role='read'):
|
||||||
|
|
||||||
if has_token_request:
|
if has_token_request:
|
||||||
repo = model.get_repository(namespace, repository)
|
repo = model.get_repository(namespace, repository)
|
||||||
token = model.create_access_token(repo, role)
|
if repo:
|
||||||
token_str = 'signature=%s' % token.code
|
token = model.create_access_token(repo, role)
|
||||||
response.headers['WWW-Authenticate'] = token_str
|
token_str = 'signature=%s' % token.code
|
||||||
response.headers['X-Docker-Token'] = token_str
|
response.headers['WWW-Authenticate'] = token_str
|
||||||
|
response.headers['X-Docker-Token'] = token_str
|
||||||
|
else:
|
||||||
|
logger.info('Token request in non-existing repo: %s/%s' %
|
||||||
|
(namespace, repository))
|
||||||
|
|
||||||
return response
|
return response
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
Reference in a new issue