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
This commit is contained in:
Dina Belova
2014-06-18 18:27:04 +04:00
parent 1ba3cd7641
commit 998c72bd77

View File

@@ -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>',