From 86376d95dff297c9306e68d17afae47f54171144 Mon Sep 17 00:00:00 2001 From: jonnary Date: Tue, 15 Nov 2016 08:04:20 -0800 Subject: [PATCH] Support "global_project" arguments for action-list In python-openstacksdk, senlin-api,senlin-engine layers, "global_project" option has been support for action-list. But in senlin client and db layer this hasn't been supported. This patch Add "global_project" arguments for action-list in senlinclient. Depends-On: I064422a2b7058a1353206ab0978fe8ce0bffd732 Change-Id: Iaae58e8121e20789d072d5acbe28921ec255a8e0 --- senlinclient/tests/unit/v1/test_action.py | 1 + senlinclient/tests/unit/v1/test_shell.py | 1 + senlinclient/v1/action.py | 9 +++++++++ senlinclient/v1/shell.py | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/senlinclient/tests/unit/v1/test_action.py b/senlinclient/tests/unit/v1/test_action.py index 80b4d762..60ee62d2 100644 --- a/senlinclient/tests/unit/v1/test_action.py +++ b/senlinclient/tests/unit/v1/test_action.py @@ -74,6 +74,7 @@ class TestActionList(TestAction): ]} defaults = { + 'global_project': False, 'marker': None, 'limit': None, 'sort': None, diff --git a/senlinclient/tests/unit/v1/test_shell.py b/senlinclient/tests/unit/v1/test_shell.py index 1be4874a..2c45d0fb 100644 --- a/senlinclient/tests/unit/v1/test_shell.py +++ b/senlinclient/tests/unit/v1/test_shell.py @@ -1612,6 +1612,7 @@ class ShellTest(testtools.TestCase): 'sort': 'status', 'limit': 20, 'marker': 'marker_id', + 'global_project': True, } queries = copy.deepcopy(args) args = self._make_args(args) diff --git a/senlinclient/v1/action.py b/senlinclient/v1/action.py index 1c4342d5..ba025f0a 100644 --- a/senlinclient/v1/action.py +++ b/senlinclient/v1/action.py @@ -58,6 +58,14 @@ class ListAction(command.Lister): metavar='', help=_('Only return actions that appear after the given action ID') ) + parser.add_argument( + '--global-project', + default=False, + action="store_true", + help=_('Whether actions from all projects should be listed. ' + ' Default to False. Setting this to True may demand ' + 'for an admin privilege') + ) parser.add_argument( '--full-id', default=False, @@ -78,6 +86,7 @@ class ListAction(command.Lister): 'sort': parsed_args.sort, 'limit': parsed_args.limit, 'marker': parsed_args.marker, + 'global_project': parsed_args.global_project, } if parsed_args.filters: diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index b28a036a..bbf4c038 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -1500,6 +1500,10 @@ def do_event_show(service, args): help=_('Limit the number of actions returned.')) @utils.arg('-m', '--marker', metavar='', help=_('Only return actions that appear after the given node ID.')) +@utils.arg('-g', '--global-project', default=False, action="store_true", + help=_('Whether actions from all projects should be listed. ' + ' Default to False. Setting this to True may demand ' + 'for an admin privilege.')) @utils.arg('-F', '--full-id', default=False, action="store_true", help=_('Print full IDs in list.')) def do_action_list(service, args): @@ -1512,6 +1516,7 @@ def do_action_list(service, args): 'sort': args.sort, 'limit': args.limit, 'marker': args.marker, + 'global_project': args.global_project, } if args.filters: