Use *_as_ids instead *_as_list
The parents_as_list and subtree_as_list query parameters limit the result to only parents and subtree where the user making the call has role assignments in. Since OSC only displays the IDs, the call would be the same as the similar *_as_ids queries, the difference is that the later doesn't enforce the role assignments (making it more useful). Output example by using this patch: $ openstack project show --children root +-------------+------------------------------+ | Field | Value | +-------------+------------------------------+ | description | | | domain_id | default | | enabled | True | | id | 123 | | is_domain | False | | name | root | | parent_id | default | | subtree | {u'456': None, u'789': None} | +-------------+------------------------------+ Change-Id: Ib7b37ae8f55190a7efcc375d5be4a2823d02d1a4
This commit is contained in:
parent
98d5641ac5
commit
a98d369a39
@ -348,15 +348,8 @@ class ShowProject(command.ShowOne):
|
||||
# identity manager.get() with kwargs directly.
|
||||
project = identity_client.projects.get(
|
||||
project.id,
|
||||
parents_as_list=parsed_args.parents,
|
||||
subtree_as_list=parsed_args.children)
|
||||
|
||||
if project._info.get('parents'):
|
||||
project._info['parents'] = [str(p['project']['id'])
|
||||
for p in project._info['parents']]
|
||||
if project._info.get('subtree'):
|
||||
project._info['subtree'] = [str(p['project']['id'])
|
||||
for p in project._info['subtree']]
|
||||
parents_as_ids=parsed_args.parents,
|
||||
subtree_as_ids=parsed_args.children)
|
||||
|
||||
project._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(project._info)))
|
||||
|
@ -845,8 +845,8 @@ class TestProjectShow(TestProject):
|
||||
|
||||
self.projects_mock.get.assert_has_calls([call(self.project.id),
|
||||
call(self.project.id,
|
||||
parents_as_list=True,
|
||||
subtree_as_list=False,
|
||||
parents_as_ids=True,
|
||||
subtree_as_ids=False,
|
||||
)])
|
||||
|
||||
collist = (
|
||||
@ -868,7 +868,7 @@ class TestProjectShow(TestProject):
|
||||
self.project.is_domain,
|
||||
self.project.name,
|
||||
self.project.parent_id,
|
||||
[self.project.parent_id],
|
||||
[{'project': {'id': self.project.parent_id}}]
|
||||
)
|
||||
self.assertEqual(data, datalist)
|
||||
|
||||
@ -904,8 +904,8 @@ class TestProjectShow(TestProject):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.projects_mock.get.assert_has_calls([call(self.project.id),
|
||||
call(self.project.id,
|
||||
parents_as_list=False,
|
||||
subtree_as_list=True,
|
||||
parents_as_ids=False,
|
||||
subtree_as_ids=True,
|
||||
)])
|
||||
|
||||
collist = (
|
||||
@ -927,7 +927,7 @@ class TestProjectShow(TestProject):
|
||||
self.project.is_domain,
|
||||
self.project.name,
|
||||
self.project.parent_id,
|
||||
['children-id'],
|
||||
[{'project': {'id': 'children-id'}}]
|
||||
)
|
||||
self.assertEqual(data, datalist)
|
||||
|
||||
@ -965,8 +965,8 @@ class TestProjectShow(TestProject):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.projects_mock.get.assert_has_calls([call(self.project.id),
|
||||
call(self.project.id,
|
||||
parents_as_list=True,
|
||||
subtree_as_list=True,
|
||||
parents_as_ids=True,
|
||||
subtree_as_ids=True,
|
||||
)])
|
||||
|
||||
collist = (
|
||||
@ -989,7 +989,7 @@ class TestProjectShow(TestProject):
|
||||
self.project.is_domain,
|
||||
self.project.name,
|
||||
self.project.parent_id,
|
||||
[self.project.parent_id],
|
||||
['children-id'],
|
||||
[{'project': {'id': self.project.parent_id}}],
|
||||
[{'project': {'id': 'children-id'}}]
|
||||
)
|
||||
self.assertEqual(data, datalist)
|
||||
|
Loading…
x
Reference in New Issue
Block a user