From f39ec4348d19a10e439dd522bb453a22975c6ee7 Mon Sep 17 00:00:00 2001 From: Kevin_Zheng Date: Mon, 6 Jun 2016 20:30:20 +0800 Subject: [PATCH] Add event_id for alarm-history display We only shows timestamp, type, and detail when calling alarm-history show; As for the pagination implementation, alarm-history can only marked using event_id, so it is not easy to use for CLI users, we should also provide event_id when we display the results. Change-Id: I2f8cf1d2dd9d6ddf28652ad8ccb4a25d2ec1082b Closes-bug: #1589480 --- aodhclient/tests/functional/test_alarm_history.py | 7 +++++++ aodhclient/v2/alarm_history_cli.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/aodhclient/tests/functional/test_alarm_history.py b/aodhclient/tests/functional/test_alarm_history.py index 08b0588..25a9055 100644 --- a/aodhclient/tests/functional/test_alarm_history.py +++ b/aodhclient/tests/functional/test_alarm_history.py @@ -64,6 +64,13 @@ class AlarmHistoryTest(base.ClientTestBase): self.assertEqual(sorted_timestamp, timestamp) self.assertEqual('creation', creation['type']) + # TEST FIELDS + result = self.aodh( + 'alarm-history', params=("show %s" % ALARM_ID)) + history = self.parser.listing(result)[0] + for key in ["timestamp", "type", "detail", "event_id"]: + self.assertIn(key, history) + # SHOW result = self.aodh( 'alarm-history', params=("show %s" % ALARM_ID)) diff --git a/aodhclient/v2/alarm_history_cli.py b/aodhclient/v2/alarm_history_cli.py index 0f8a3dc..135a775 100644 --- a/aodhclient/v2/alarm_history_cli.py +++ b/aodhclient/v2/alarm_history_cli.py @@ -42,7 +42,7 @@ class CliAlarmHistorySearch(lister.Lister): class CliAlarmHistoryShow(lister.Lister): """Show history for an alarm""" - COLS = ('timestamp', 'type', 'detail') + COLS = ('timestamp', 'type', 'detail', 'event_id') def get_parser(self, prog_name): parser = super(CliAlarmHistoryShow, self).get_parser(prog_name)