change alarms cli
Change-Id: I0bb54cecebc35489ab017b35563a20a067552d56
This commit is contained in:
parent
13c8e61dd9
commit
a8a74d2f86
@ -17,10 +17,10 @@ class Alarm(object):
|
||||
def __init__(self, api):
|
||||
self.api = api
|
||||
|
||||
def list(self, entity_id):
|
||||
def list(self, vitrage_id):
|
||||
"""Get a all alarms on entity
|
||||
|
||||
:param entity_id: the id for the entity
|
||||
:param vitrage_id: the id for the entity
|
||||
"""
|
||||
params = dict(entity_id=entity_id)
|
||||
params = dict(vitrage_id=vitrage_id)
|
||||
return self.api.get(self.url, params=params).json()
|
||||
|
@ -20,16 +20,16 @@ class AlarmsList(lister.Lister):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AlarmsList, self).get_parser(prog_name)
|
||||
parser.add_argument('id',
|
||||
parser.add_argument("vitrage_id",
|
||||
default='all',
|
||||
nargs='?',
|
||||
metavar='<vitrage id>',
|
||||
help='Vitrage id of the affected resource')
|
||||
metavar="<vitrage id>",
|
||||
help="Vitrage id of the affected resource")
|
||||
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
entity_id = parsed_args.id
|
||||
alarms = self.app.client.alarms.list(entity_id=entity_id)
|
||||
vitrage_id = parsed_args.vitrage_id
|
||||
alarms = self.app.client.alarms.list(vitrage_id=vitrage_id)
|
||||
return utils.list2cols(
|
||||
('type', 'name', 'severity', 'update_timestamp'), alarms)
|
||||
|
Loading…
Reference in New Issue
Block a user