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 <spyridon.trigazis@cern.ch>
This commit is contained in:
Spyros Trigazis 2020-01-30 09:26:17 +01:00
parent 6bccfc0d6e
commit d9e6f2787f
4 changed files with 22 additions and 22 deletions

View File

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

View File

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

View File

@ -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': {},

View File

@ -4280,7 +4280,7 @@ def do_type_create(cs, args):
metavar='<is_public>',
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)."""