Merge pull request #2508 from coreos-inc/appr-push-to-image
Change appr error if you try to push to an image repository
This commit is contained in:
commit
255d71afa2
2 changed files with 5 additions and 5 deletions
|
@ -2,10 +2,10 @@ import logging
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from flask import abort
|
|
||||||
|
|
||||||
from data import model
|
from data import model
|
||||||
|
|
||||||
|
from util.http import abort
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ def disallow_for_image_repository(get_reponame_method=_get_reponame_kwargs):
|
||||||
image_repo = model.repository.get_repository(namespace_name, repo_name, kind_filter='image')
|
image_repo = model.repository.get_repository(namespace_name, repo_name, kind_filter='image')
|
||||||
if image_repo is not None:
|
if image_repo is not None:
|
||||||
logger.debug('Tried to invoked a CNR method on an image repository')
|
logger.debug('Tried to invoked a CNR method on an image repository')
|
||||||
abort(501)
|
abort(405, message='Cannot push an application to an image repository with the same name')
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
return wrapped
|
return wrapped
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from werkzeug.exceptions import NotImplemented as NIE
|
from werkzeug.exceptions import HTTPException
|
||||||
|
|
||||||
from data import model
|
from data import model
|
||||||
from endpoints.appr import require_app_repo_read
|
from endpoints.appr import require_app_repo_read
|
||||||
|
@ -14,6 +14,6 @@ def test_require_app_repo_read(app):
|
||||||
def empty(**kwargs):
|
def empty(**kwargs):
|
||||||
called[0] = True
|
called[0] = True
|
||||||
|
|
||||||
with pytest.raises(NIE):
|
with pytest.raises(HTTPException):
|
||||||
empty(namespace='devtable', package_name='simple')
|
empty(namespace='devtable', package_name='simple')
|
||||||
assert not called[0]
|
assert not called[0]
|
||||||
|
|
Reference in a new issue