Merge "fix the type of all_tenants
"
This commit is contained in:
commit
473b5ae424
@ -1,18 +0,0 @@
|
||||
# Copyright 2016 - Nokia Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import VertexProperties as VProps
|
||||
|
||||
RCA_QUERY = {'==': {VProps. CATEGORY: EntityCategory.ALARM}}
|
@ -16,6 +16,7 @@ import json
|
||||
import pecan
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils.strutils import bool_from_string
|
||||
from pecan.core import abort
|
||||
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
@ -29,10 +30,11 @@ class AlarmsController(RootRestController):
|
||||
|
||||
@pecan.expose('json')
|
||||
def index(self, vitrage_id, all_tenants=False):
|
||||
return self.post(vitrage_id, all_tenants)
|
||||
return self.get(vitrage_id, all_tenants)
|
||||
|
||||
@pecan.expose('json')
|
||||
def post(self, vitrage_id, all_tenants=False):
|
||||
def get(self, vitrage_id, all_tenants=False):
|
||||
all_tenants = bool_from_string(all_tenants)
|
||||
if all_tenants:
|
||||
enforce("list alarms:all_tenants", pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
@ -17,6 +17,7 @@ import json
|
||||
import pecan
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils.strutils import bool_from_string
|
||||
from pecan.core import abort
|
||||
from vitrage.api.controllers.rest import RootRestController
|
||||
from vitrage.api.policy import enforce
|
||||
@ -32,6 +33,7 @@ class RCAController(RootRestController):
|
||||
|
||||
@pecan.expose('json')
|
||||
def get(self, alarm_id, all_tenants=False):
|
||||
all_tenants = bool_from_string(all_tenants)
|
||||
if all_tenants:
|
||||
enforce('get rca:all_tenants', pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
@ -16,6 +16,7 @@
|
||||
import json
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils.strutils import bool_from_string
|
||||
import pecan
|
||||
from pecan.core import abort
|
||||
|
||||
@ -34,6 +35,7 @@ class TopologyController(RootRestController):
|
||||
|
||||
@pecan.expose('json')
|
||||
def post(self, depth, graph_type, query, root, all_tenants=False):
|
||||
all_tenants = bool_from_string(all_tenants)
|
||||
if all_tenants:
|
||||
enforce('get topology:all_tenants', pecan.request.headers,
|
||||
pecan.request.enforcer, {})
|
||||
|
@ -77,7 +77,7 @@ class TestEvents(base.BaseTestCase):
|
||||
|
||||
def _check_alarms(self):
|
||||
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
|
||||
all_tenants=False)
|
||||
all_tenants=True)
|
||||
if api_alarms:
|
||||
return True, api_alarms
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user