summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDina Belova <dbelova@mirantis.com>2014-06-18 18:27:04 +0400
committerDina Belova <dbelova@mirantis.com>2014-06-18 18:30:38 +0400
commit998c72bd77d63e370b9167a205993f6731dcabf3 (patch)
treee3c16e64558cd5e5781ae9c33514b02ecf455935
parent1ba3cd7641953f875d5c9a651f0f06d2841ff258 (diff)
downloadpython-ceilometerclient-998c72bd77d63e370b9167a205993f6731dcabf3.tar.gz
Fix the alarm history order shown to user
In the Ceilometer storage backends implementation we are specially sorting the alarm history points in the following way: the first one by the timestamp should be the last one in the list. The Python client itself provides the information in this way, but the table printed had the opposite one, so this was fixed. Change-Id: If39bb5868e360f37ed76c12b55fc71eade331f47
-rw-r--r--ceilometerclient/v2/shell.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py
index 7c4629b..d5bddf5 100644
--- a/ceilometerclient/v2/shell.py
+++ b/ceilometerclient/v2/shell.py
@@ -649,9 +649,13 @@ def do_alarm_history(cc, args={}):
raise exc.CommandError('Alarm not found: %s' % args.alarm_id)
field_labels = ['Type', 'Timestamp', 'Detail']
fields = ['type', 'timestamp', 'detail']
+ # We're using sortby=None as the alarm history returned from the Ceilometer
+ # is already sorted in the "the newer state is the earlier one in the
+ # list". If we'll pass any field as a sortby param, it'll be sorted in the
+ # ASC way by the PrettyTable
utils.print_list(history, fields, field_labels,
formatters={'detail': alarm_change_detail_formatter},
- sortby=1)
+ sortby=None)
@utils.arg('-q', '--query', metavar='<QUERY>',