Commit 9f61dc4d authored by Christos Stavrakakis's avatar Christos Stavrakakis

Ensure we return cloud faults under any API prefix

parent 9cb2e33b
......@@ -32,8 +32,10 @@
# or implied, of GRNET S.A.
from django.conf.urls.defaults import patterns, url
from snf_django.lib.api import api_endpoint_not_found
urlpatterns = patterns(
'astakos.api.tokens',
url(r'^v2.0/tokens/?$', 'authenticate', name='tokens_authenticate'),
url(r'^.*', api_endpoint_not_found),
)
......@@ -32,6 +32,7 @@
# or implied, of GRNET S.A.
from django.conf.urls.defaults import patterns, url, include
from snf_django.lib.api import api_endpoint_not_found
astakos_account_v1_0 = patterns(
......@@ -60,4 +61,5 @@ astakos_account_v1_0 += patterns(
urlpatterns = patterns(
'',
url(r'^v1.0/', include(astakos_account_v1_0)),
(r'^.*', api_endpoint_not_found),
)
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from snf_django.lib.api import faults
from synnefo.api.util import api_method
@api_method()
def not_found(request):
raise faults.BadRequest('Not found.')
@api_method()
def method_not_allowed(request):
raise faults.BadRequest('Method not allowed')
......@@ -33,7 +33,7 @@
from django.conf.urls.defaults import include, patterns
from snf_django.lib.api import not_found
from snf_django.lib.api import api_endpoint_not_found
from synnefo.api import servers, flavors, images, networks
from synnefo.api.versions import versions_list, version_details
......@@ -56,5 +56,5 @@ urlpatterns = patterns(
(r'^v2.0/(?:.json|.xml|.atom)?$', version_details,
{'api_version': 'v1.1'}),
(r'^v2.0/', include(api20_patterns)),
(r'^.+', not_found),
(r'^.*', api_endpoint_not_found),
)
......@@ -33,6 +33,7 @@
from django.conf.urls.defaults import patterns, include
from django.http import HttpResponseNotAllowed
from snf_django.lib.api import api_endpoint_not_found
from synnefo.plankton import views
......@@ -90,4 +91,5 @@ image_v1_patterns = patterns(
urlpatterns = patterns(
'',
(r'^v1.0/', include(image_v1_patterns)),
(r'^.*', api_endpoint_not_found),
)
......@@ -210,9 +210,11 @@ def render_fault(request, fault):
return response
def not_found(request):
raise faults.BadRequest('Not found.')
@api_method(token_required=False, user_required=False)
def api_endpoint_not_found(request):
raise faults.BadRequest("API endpoint not found")
def method_not_allowed(request):
@api_method(token_required=False, user_required=False)
def api_method_not_allowed(request):
raise faults.BadRequest('Method not allowed')
......@@ -36,6 +36,7 @@ from django.conf.urls.defaults import include, patterns
from snf_django.lib.api.proxy import proxy
from snf_django.lib.api.utils import prefix_pattern
from snf_django.lib.api.urls import api_patterns
from snf_django.lib.api import api_endpoint_not_found
from pithos.api.settings import (
BASE_PATH, ASTAKOS_BASE_URL, BASE_ASTAKOS_PROXY_PATH,
ASTAKOS_ACCOUNTS_PREFIX, PROXY_USER_SERVICES,
......@@ -61,6 +62,8 @@ pithos_patterns = patterns(
'',
(r'{0}v1/'.format(prefix_pattern(PITHOS_PREFIX)),
include(pithos_api_patterns)),
(r'{0}.*'.format(prefix_pattern(PITHOS_PREFIX)),
api_endpoint_not_found),
(r'{0}(?P<v_public>.+?)/?$'.format(prefix_pattern(PUBLIC_PREFIX)),
'pithos.api.public.public_demux'),
(r'{0}'.format(prefix_pattern(UI_PREFIX)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment