diff --git a/senlinclient/tests/unit/v1/test_shell.py b/senlinclient/tests/unit/v1/test_shell.py index 606c696b..1c2a197a 100644 --- a/senlinclient/tests/unit/v1/test_shell.py +++ b/senlinclient/tests/unit/v1/test_shell.py @@ -1563,6 +1563,7 @@ class ShellTest(testtools.TestCase): queries['action'] = 'NODE_DELETE' args = self._make_args(args) formatters = {} + sortby_index = None events = mock.Mock() service.events.return_value = events @@ -1571,6 +1572,7 @@ class ShellTest(testtools.TestCase): service.events.assert_called_once_with(**queries) mock_print.assert_called_once_with(events, fields, formatters=formatters, + sortby_index=sortby_index, field_labels=field_labels) @mock.patch.object(utils, 'print_dict') diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 20e89137..6c7a717b 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -1455,6 +1455,8 @@ def do_event_list(service, args): if args.filters: queries.update(utils.format_parameters(args.filters)) + sortby_index = None if args.sort else 0 + formatters = {} if not args.full_id: formatters['id'] = lambda x: x.id[:8] @@ -1464,7 +1466,7 @@ def do_event_list(service, args): events = service.events(**queries) utils.print_list(events, fields, formatters=formatters, - field_labels=field_labels) + sortby_index=sortby_index, field_labels=field_labels) @utils.arg('id', metavar='',