Bypass the auth when listing Gnocchi versions

Change-Id: Ied303615d53ac8283ac815e84a90857d39edfcbf
Closes-bug: #1522674
This commit is contained in:
Mehdi Abaakouk 2016-01-18 11:58:08 +01:00 committed by Mehdi Abaakouk (sileht)
parent 63c3dad97c
commit 3acea2d12a
6 changed files with 31 additions and 18 deletions

View File

@ -277,7 +277,7 @@ function configure_gnocchi {
iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline gnocchi+auth
fi
else
iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline gnocchi
iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline gnocchi+noauth
fi
# Configure the indexer database

View File

@ -1,13 +1,27 @@
# Use gnocchi+auth in the pipeline if you want to use keystone authentication
[pipeline:main]
pipeline = gnocchi
pipeline = gnocchi+noauth
[pipeline:gnocchi+auth]
pipeline = keystone_authtoken gnocchi
[composite:gnocchi+noauth]
use = egg:Paste#urlmap
/ = gnocchiversions
/v1 = gnocchiv1
[app:gnocchi]
[composite:gnocchi+auth]
use = egg:Paste#urlmap
/ = gnocchiversions
/v1 = gnocchiv1+auth
[pipeline:gnocchiv1+auth]
pipeline = keystone_authtoken gnocchiv1
[app:gnocchiversions]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.RootController
root = gnocchi.rest.VersionsController
[app:gnocchiv1]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.V1Controller
[filter:keystone_authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory

View File

@ -304,7 +304,7 @@ class ArchivePoliciesController(rest.RestController):
except indexer.ArchivePolicyAlreadyExists as e:
abort(409, e)
location = "/v1/archive_policy/" + ap.name
location = "/archive_policy/" + ap.name
set_resp_location_hdr(location)
pecan.response.status = 201
return ap
@ -335,7 +335,7 @@ class ArchivePolicyRulesController(rest.RestController):
except indexer.ArchivePolicyRuleAlreadyExists as e:
abort(409, e)
location = "/v1/archive_policy_rule/" + ap.name
location = "/archive_policy_rule/" + ap.name
set_resp_location_hdr(location)
pecan.response.status = 201
return ap
@ -639,7 +639,7 @@ class MetricsController(rest.RestController):
archive_policy_name=body['archive_policy_name'])
except indexer.NoSuchArchivePolicy as e:
abort(400, e)
set_resp_location_hdr("/v1/metric/" + str(m.id))
set_resp_location_hdr("/metric/" + str(m.id))
pecan.response.status = 201
return m
@ -961,7 +961,7 @@ class ResourcesController(rest.RestController):
abort(400, e)
except indexer.ResourceAlreadyExists as e:
abort(409, e)
set_resp_location_hdr("/v1/resource/"
set_resp_location_hdr("/resource/"
+ self._resource_type + "/"
+ six.text_type(resource.id))
etag_set_headers(resource)
@ -997,7 +997,7 @@ class ResourcesByTypeController(rest.RestController):
def get_all(self):
return dict(
(ext.name,
pecan.request.application_url + '/v1/resource/' + ext.name)
pecan.request.application_url + '/resource/' + ext.name)
for ext in RESOURCE_SCHEMA_MANAGER)
@pecan.expose()
@ -1293,18 +1293,16 @@ class V1Controller(object):
"version": "1.0",
"links": [
{"rel": "self",
"href": pecan.request.application_url + "/v1"}
"href": pecan.request.application_url}
] + [
{"rel": name,
"href": pecan.request.application_url + "/v1/" + name}
"href": pecan.request.application_url + "/" + name}
for name in sorted(self.sub_controllers)
]
}
class RootController(object):
v1 = V1Controller()
class VersionsController(object):
@staticmethod
@pecan.expose('json')
def index():

View File

@ -128,7 +128,7 @@ class ConfigFixture(fixture.GabbiFixture):
s.upgrade(index)
LOAD_APP_KWARGS = {
'appname': 'gnocchi',
'appname': 'gnocchi+noauth',
'storage': s,
'indexer': index,
'conf': conf,

View File

@ -133,7 +133,7 @@ class RestTest(tests_base.TestCase, testscenarios.TestWithScenarios):
# See: https://bugs.launchpad.net/keystonemiddleware/+bug/1466499
self.app = TestingApp(app.load_app(conf=self.conf,
appname="gnocchi+auth"
if self.auth else "gnocchi",
if self.auth else "gnocchi+noauth",
indexer=self.index,
storage=self.storage,
not_implemented_middleware=False),

View File

@ -17,5 +17,6 @@ werkzeug
trollius
retrying
WebOb>=1.4.1
Paste
PasteDeploy
prettytable