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:
parent
6bccfc0d6e
commit
d9e6f2787f
manilaclient
@ -441,8 +441,8 @@ class ListShare(command.Lister):
|
|||||||
parsed_args.user,
|
parsed_args.user,
|
||||||
parsed_args.user_domain).id
|
parsed_args.user_domain).id
|
||||||
|
|
||||||
# set value of 'all_projects' when using project option
|
# set value of 'all_tenants' when using project option
|
||||||
all_projects = bool(parsed_args.project) or parsed_args.all_projects
|
all_tenants = bool(parsed_args.project) or parsed_args.all_projects
|
||||||
|
|
||||||
share_type_id = None
|
share_type_id = None
|
||||||
if parsed_args.share_type:
|
if parsed_args.share_type:
|
||||||
@ -472,7 +472,7 @@ class ListShare(command.Lister):
|
|||||||
parsed_args.share_server).id
|
parsed_args.share_server).id
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': all_projects,
|
'all_tenants': all_tenants,
|
||||||
'is_public': parsed_args.public,
|
'is_public': parsed_args.public,
|
||||||
'metadata': utils.extract_key_value_options(
|
'metadata': utils.extract_key_value_options(
|
||||||
parsed_args.property),
|
parsed_args.property),
|
||||||
|
@ -259,7 +259,7 @@ class ManilaCLIClient(base.CLIClient):
|
|||||||
if not set then it will not be updated.
|
if not set then it will not be updated.
|
||||||
:param is_public: bool/str -- boolean or its string alias.
|
:param is_public: bool/str -- boolean or its string alias.
|
||||||
new visibility of the share type.If set to True, share
|
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 ') % {
|
cmd = ('type-update %(share_type_id)s ') % {
|
||||||
@ -562,7 +562,7 @@ class ManilaCLIClient(base.CLIClient):
|
|||||||
"""List share networks.
|
"""List share networks.
|
||||||
|
|
||||||
:param all_tenants: bool -- whether to list share-networks that belong
|
: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.
|
:param filters: dict -- filters for listing of share networks.
|
||||||
Example, input:
|
Example, input:
|
||||||
{'project_id': 'foo'}
|
{'project_id': 'foo'}
|
||||||
@ -801,7 +801,7 @@ class ManilaCLIClient(base.CLIClient):
|
|||||||
"""List shares.
|
"""List shares.
|
||||||
|
|
||||||
:param all_tenants: bool -- whether to list shares that belong
|
: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.
|
:param filters: dict -- filters for listing of shares.
|
||||||
Example, input:
|
Example, input:
|
||||||
{'project_id': 'foo'}
|
{'project_id': 'foo'}
|
||||||
|
@ -288,7 +288,7 @@ class TestShareList(TestShare):
|
|||||||
|
|
||||||
def _get_search_opts(self):
|
def _get_search_opts(self):
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -320,7 +320,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -363,7 +363,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -382,7 +382,7 @@ class TestShareList(TestShare):
|
|||||||
}
|
}
|
||||||
|
|
||||||
search_opts['project_id'] = self.project.id
|
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(
|
self.shares_mock.list.assert_called_once_with(
|
||||||
search_opts=search_opts,
|
search_opts=search_opts,
|
||||||
@ -411,7 +411,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -430,7 +430,7 @@ class TestShareList(TestShare):
|
|||||||
}
|
}
|
||||||
|
|
||||||
search_opts['project_id'] = self.project.id
|
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(
|
self.shares_mock.list.assert_called_once_with(
|
||||||
search_opts=search_opts,
|
search_opts=search_opts,
|
||||||
@ -457,7 +457,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -503,7 +503,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -548,7 +548,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -593,7 +593,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -623,7 +623,7 @@ class TestShareList(TestShare):
|
|||||||
|
|
||||||
self.assertEqual(data, tuple(cmd_data))
|
self.assertEqual(data, tuple(cmd_data))
|
||||||
|
|
||||||
def test_share_list_all_projects(self):
|
def test_share_list_all_tenants(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--all-projects',
|
'--all-projects',
|
||||||
]
|
]
|
||||||
@ -638,7 +638,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -656,7 +656,7 @@ class TestShareList(TestShare):
|
|||||||
'offset': None,
|
'offset': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
search_opts['all_projects'] = True
|
search_opts['all_tenants'] = True
|
||||||
|
|
||||||
self.shares_mock.list.assert_called_once_with(
|
self.shares_mock.list.assert_called_once_with(
|
||||||
search_opts=search_opts,
|
search_opts=search_opts,
|
||||||
@ -682,7 +682,7 @@ class TestShareList(TestShare):
|
|||||||
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
cmd_columns, cmd_data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
@ -789,7 +789,7 @@ class TestShareList(TestShare):
|
|||||||
self.assertEqual(self.columns, cmd_columns)
|
self.assertEqual(self.columns, cmd_columns)
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'all_projects': False,
|
'all_tenants': False,
|
||||||
'is_public': False,
|
'is_public': False,
|
||||||
'metadata': {},
|
'metadata': {},
|
||||||
'extra_specs': {},
|
'extra_specs': {},
|
||||||
|
@ -4280,7 +4280,7 @@ def do_type_create(cs, args):
|
|||||||
metavar='<is_public>',
|
metavar='<is_public>',
|
||||||
action='single_alias',
|
action='single_alias',
|
||||||
help="New visibility of the share type. If set to True, share type will "
|
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")
|
@api_versions.wraps("2.50")
|
||||||
def do_type_update(cs, args):
|
def do_type_update(cs, args):
|
||||||
"""Update share type name, description, and/or visibility. (Admin only)."""
|
"""Update share type name, description, and/or visibility. (Admin only)."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user