summaryrefslogtreecommitdiff
path: root/cinderclient
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2018-12-26 07:26:10 +0000
committerwhoami-rajat <rajatdhasmana@gmail.com>2019-02-18 14:34:35 +0530
commit532aef0c738edc937dbfa1b54efd8d7773af2204 (patch)
treef25241d00646a56ec045c2577e60d70a7a1b58b3 /cinderclient
parent3c143d95b3b270f77bf9fa55c16ae06505fe107c (diff)
downloadpython-cinderclient-532aef0c738edc937dbfa1b54efd8d7773af2204.tar.gz
Fix: cinder group-list not working with non-admin user
The all_tenants filter is passed to API when it's value is 0 (when not specified) which shouldn't be the case. This patch only allows adding of all_tenants when specified manually by user. Change-Id: Ic7810c4d6e9f4be7c28c7a8778d57bb5ccb996a0 Closes-Bug: #1808621 Closes-Bug: #1808622
Diffstat (limited to 'cinderclient')
-rw-r--r--cinderclient/tests/unit/v3/test_shell.py16
-rw-r--r--cinderclient/v3/shell.py8
2 files changed, 11 insertions, 13 deletions
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index a5ed614..eaba63f 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -140,28 +140,28 @@ class ShellTest(utils.TestCase):
{'command':
'group-list --filters name=456',
'expected':
- '/groups/detail?all_tenants=0&name=456'},
+ '/groups/detail?name=456'},
{'command':
'group-list --filters status=available',
'expected':
- '/groups/detail?all_tenants=0&status=available'},
+ '/groups/detail?status=available'},
{'command':
'group-list --filters name~=456',
'expected':
- '/groups/detail?all_tenants=0&name~=456'},
+ '/groups/detail?name~=456'},
# testcases for list group-snapshot
{'command':
'group-snapshot-list --status=error --filters status=available',
'expected':
- '/group_snapshots/detail?all_tenants=0&status=available'},
+ '/group_snapshots/detail?status=available'},
{'command':
'group-snapshot-list --filters availability_zone=123',
'expected':
- '/group_snapshots/detail?all_tenants=0&availability_zone=123'},
+ '/group_snapshots/detail?availability_zone=123'},
{'command':
'group-snapshot-list --filters status~=available',
'expected':
- '/group_snapshots/detail?all_tenants=0&status~=available'},
+ '/group_snapshots/detail?status~=available'},
# testcases for list message
{'command':
'message-list --event_id=123 --filters event_id=456',
@@ -632,7 +632,7 @@ class ShellTest(utils.TestCase):
def test_group_list(self):
self.run_command('--os-volume-api-version 3.13 group-list')
- self.assert_called_anytime('GET', '/groups/detail?all_tenants=0')
+ self.assert_called_anytime('GET', '/groups/detail')
def test_group_list__with_all_tenant(self):
self.run_command(
@@ -692,7 +692,7 @@ class ShellTest(utils.TestCase):
def test_group_snapshot_list(self):
self.run_command('--os-volume-api-version 3.14 group-snapshot-list')
self.assert_called_anytime('GET',
- '/group_snapshots/detail?all_tenants=0')
+ '/group_snapshots/detail')
def test_group_snapshot_show(self):
self.run_command('--os-volume-api-version 3.14 '
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index 1de0a3f..3573ff2 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -1291,7 +1291,7 @@ def do_manageable_list(cs, args):
nargs='?',
type=int,
const=1,
- default=utils.env('ALL_TENANTS', default=0),
+ default=utils.env('ALL_TENANTS', default=None),
help='Shows details for all tenants. Admin only.')
@utils.arg('--filters',
type=six.text_type,
@@ -1566,7 +1566,7 @@ def do_group_list_replication_targets(cs, args):
nargs='?',
type=int,
const=1,
- default=0,
+ default=utils.env('ALL_TENANTS', default=None),
help='Shows details for all tenants. Admin only.')
@utils.arg('--status',
metavar='<status>',
@@ -1590,10 +1590,8 @@ def do_group_list_replication_targets(cs, args):
def do_group_snapshot_list(cs, args):
"""Lists all group snapshots."""
- all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants))
-
search_opts = {
- 'all_tenants': all_tenants,
+ 'all_tenants': args.all_tenants,
'status': args.status,
'group_id': args.group_id,
}