From d9e6f2787ff19c47fd0ea2ebda6e9e77b2425bbd Mon Sep 17 00:00:00 2001 From: Spyros Trigazis Date: Thu, 30 Jan 2020 09:26:17 +0100 Subject: [PATCH] OSC Fix list for all projects The manila api accepts all_tenants as a parametes in the API. Users can send --all-projects via OSC and the client translates to all_tenants. Change-Id: I5f9e685659160e676e70281e8f258a19b6133bfa Partially-implements: bp openstack-client-support Signed-off-by: Spyros Trigazis --- manilaclient/osc/v2/share.py | 6 ++-- manilaclient/tests/functional/client.py | 6 ++-- manilaclient/tests/unit/osc/v2/test_share.py | 30 ++++++++++---------- manilaclient/v2/shell.py | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/manilaclient/osc/v2/share.py b/manilaclient/osc/v2/share.py index b76dd0471..8c584a368 100644 --- a/manilaclient/osc/v2/share.py +++ b/manilaclient/osc/v2/share.py @@ -441,8 +441,8 @@ class ListShare(command.Lister): parsed_args.user, parsed_args.user_domain).id - # set value of 'all_projects' when using project option - all_projects = bool(parsed_args.project) or parsed_args.all_projects + # set value of 'all_tenants' when using project option + all_tenants = bool(parsed_args.project) or parsed_args.all_projects share_type_id = None if parsed_args.share_type: @@ -472,7 +472,7 @@ class ListShare(command.Lister): parsed_args.share_server).id search_opts = { - 'all_projects': all_projects, + 'all_tenants': all_tenants, 'is_public': parsed_args.public, 'metadata': utils.extract_key_value_options( parsed_args.property), diff --git a/manilaclient/tests/functional/client.py b/manilaclient/tests/functional/client.py index 89439c2a0..0787bd8db 100644 --- a/manilaclient/tests/functional/client.py +++ b/manilaclient/tests/functional/client.py @@ -259,7 +259,7 @@ class ManilaCLIClient(base.CLIClient): if not set then it will not be updated. :param is_public: bool/str -- boolean or its string alias. new visibility of the share type.If set to True, share - type will be available to all projects in the cloud. + type will be available to all tenants in the cloud. """ cmd = ('type-update %(share_type_id)s ') % { @@ -562,7 +562,7 @@ class ManilaCLIClient(base.CLIClient): """List share networks. :param all_tenants: bool -- whether to list share-networks that belong - only to current project or for all projects. + only to current project or for all tenants. :param filters: dict -- filters for listing of share networks. Example, input: {'project_id': 'foo'} @@ -801,7 +801,7 @@ class ManilaCLIClient(base.CLIClient): """List shares. :param all_tenants: bool -- whether to list shares that belong - only to current project or for all projects. + only to current project or for all tenants. :param filters: dict -- filters for listing of shares. Example, input: {'project_id': 'foo'} diff --git a/manilaclient/tests/unit/osc/v2/test_share.py b/manilaclient/tests/unit/osc/v2/test_share.py index 026544af1..9849f234c 100644 --- a/manilaclient/tests/unit/osc/v2/test_share.py +++ b/manilaclient/tests/unit/osc/v2/test_share.py @@ -288,7 +288,7 @@ class TestShareList(TestShare): def _get_search_opts(self): search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -320,7 +320,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -363,7 +363,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -382,7 +382,7 @@ class TestShareList(TestShare): } search_opts['project_id'] = self.project.id - search_opts['all_projects'] = True + search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, @@ -411,7 +411,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -430,7 +430,7 @@ class TestShareList(TestShare): } search_opts['project_id'] = self.project.id - search_opts['all_projects'] = True + search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, @@ -457,7 +457,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -503,7 +503,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -548,7 +548,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -593,7 +593,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -623,7 +623,7 @@ class TestShareList(TestShare): self.assertEqual(data, tuple(cmd_data)) - def test_share_list_all_projects(self): + def test_share_list_all_tenants(self): arglist = [ '--all-projects', ] @@ -638,7 +638,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -656,7 +656,7 @@ class TestShareList(TestShare): 'offset': None, } - search_opts['all_projects'] = True + search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, @@ -682,7 +682,7 @@ class TestShareList(TestShare): cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, @@ -789,7 +789,7 @@ class TestShareList(TestShare): self.assertEqual(self.columns, cmd_columns) search_opts = { - 'all_projects': False, + 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, diff --git a/manilaclient/v2/shell.py b/manilaclient/v2/shell.py index 61bd1c77c..dc5e023ea 100644 --- a/manilaclient/v2/shell.py +++ b/manilaclient/v2/shell.py @@ -4280,7 +4280,7 @@ def do_type_create(cs, args): metavar='', action='single_alias', help="New visibility of the share type. If set to True, share type will " - "be available to all projects in the cloud.") + "be available to all tenants in the cloud.") @api_versions.wraps("2.50") def do_type_update(cs, args): """Update share type name, description, and/or visibility. (Admin only)."""