Enable POST samples API when gnocchi enabled
Currently, if we enabled gnocchi, the every API of meters, resources, samples will be disabled and 410 response will be returned. The posting samples API shouldn't be diabled. Change-Id: I142e4470a69a0782cabb6b1b4160faac0d48f0df Closes-Bug: #1505283
This commit is contained in:
parent
130b8519df
commit
e973877166
@ -156,6 +156,8 @@ class V2Controller(object):
|
||||
def _lookup(self, kind, *remainder):
|
||||
if (kind in ['meters', 'resources', 'samples']
|
||||
and self.gnocchi_is_enabled):
|
||||
if kind == 'meters' and pecan.request.method == 'POST':
|
||||
return meters.MetersController(), remainder
|
||||
gnocchi_abort()
|
||||
elif kind == 'meters':
|
||||
return meters.MetersController(), remainder
|
||||
|
@ -65,6 +65,14 @@ class TestAPIUpgradePath(v2.FunctionalTest):
|
||||
"limit": 3
|
||||
}, status=410)
|
||||
self.assertIn(b'Gnocchi API', response.body)
|
||||
self.post_json('/meters/fake_counter',
|
||||
params=[{
|
||||
"counter_type": "gauge",
|
||||
"counter_name": "fake_counter",
|
||||
"resource_id": "fake_resource_id",
|
||||
"counter_unit": "fake_unit",
|
||||
"counter_volume": "1"
|
||||
}], status=201)
|
||||
|
||||
def _do_test_alarm_redirect(self):
|
||||
response = self.app.get(self.PATH_PREFIX + '/alarms',
|
||||
|
Loading…
Reference in New Issue
Block a user