endpoints.v1: return 405 for non-docker repos

This commit is contained in:
Jimmy Zelinskie 2017-03-22 16:53:12 -04:00 committed by Joseph Schorr
parent 48ba59d615
commit ca7a0f14d8
3 changed files with 28 additions and 28 deletions

View file

@ -183,8 +183,8 @@ def create_repository(namespace_name, repo_name):
issue='no-repo-write-permission',
namespace=namespace_name, repository=repo_name)
elif repo.kind != 'image':
msg = 'This repository is for a managing resource type other than docker images.'
abort(415, message=msg, namespace=namespace_name)
msg = 'This repository is for managing %s resources and not container images.' % repo.kind
abort(405, message=msg, namespace=namespace_name)
else:
create_perm = CreateRepositoryPermission(namespace_name)
@ -228,8 +228,8 @@ def update_images(namespace_name, repo_name):
# Make sure the repo actually exists.
abort(404, message='Unknown repository', issue='unknown-repo')
elif repo.kind != 'image':
msg = 'This repository is for a managing resource type other than docker images.'
abort(415, message=msg, namespace=namespace_name)
msg = 'This repository is for managing %s resources and not container images.' % repo.kind
abort(405, message=msg, namespace=namespace_name)
# Generate a job for each notification that has been added to this repo
logger.debug('Adding notifications for repository')
@ -263,8 +263,8 @@ def get_repository_images(namespace_name, repo_name):
if not repo:
abort(404, message='Unknown repository', issue='unknown-repo')
elif repo.kind != 'image':
msg = 'This repository is for a managing resource type other than docker images.'
abort(415, message=msg, namespace=namespace_name)
msg = 'This repository is for managing %s resources and not container images.' % repo.kind
abort(405, message=msg, namespace=namespace_name)
logger.debug('Building repository image response')
resp = make_response(json.dumps([]), 200)