Show "target_project_id" attribute properly for network rbac object
According to the code in SDK: https://github.com/openstack/python-openstacksdk/blob/master/openstack/network/v2/rbac_policy.py#L34 we can see the conlumn of "target_tenant" should be "targer_project_id" but not "target_project". It is the reason why could not show the "target_project" in OSC, so this patch fix it. Before this change: (openstack) network rbac show b74fd644-e057-4d44-8ae1-7ca9967ea1e1 +----------------+--------------------------------------+ | Field | Value | +----------------+--------------------------------------+ | action | access_as_shared | | id | b74fd644-e057-4d44-8ae1-7ca9967ea1e1 | | object_id | 8735b57f-606a-4f65-9902-2052a6d2a66d | | object_type | network | | project_id | 01c0ba43101b4080a52a5f79a55c56ff | | target_project | | +----------------+--------------------------------------+ After this change: (openstack) network rbac show b74fd644-e057-4d44-8ae1-7ca9967ea1e1 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | action | access_as_shared | | id | b74fd644-e057-4d44-8ae1-7ca9967ea1e1 | | object_id | 8735b57f-606a-4f65-9902-2052a6d2a66d | | object_type | network | | project_id | 01c0ba43101b4080a52a5f79a55c56ff | | target_project_id | c7ab4d2ea9e1487095a8ca24ea44ef38 | +-------------------+--------------------------------------+ Change-Id: I53df127bfc3e43288c6afecdf872e6101b94a658 Closes-Bug: #1608903
This commit is contained in:
parent
06ea24725b
commit
7f93d8cc88
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import testtools
|
|
||||||
|
|
||||||
from functional.common import test
|
from functional.common import test
|
||||||
|
|
||||||
|
|
||||||
@ -57,18 +55,13 @@ class NetworkRBACTests(test.TestCase):
|
|||||||
raw_output = self.openstack('network rbac show ' + self.ID + opts)
|
raw_output = self.openstack('network rbac show ' + self.ID + opts)
|
||||||
self.assertEqual(self.ID + "\n", raw_output)
|
self.assertEqual(self.ID + "\n", raw_output)
|
||||||
|
|
||||||
# TODO(Huanxuan Ao): This test can pass after bug
|
|
||||||
# https://bugs.launchpad.net/python-openstackclient/+bug/1608903 fixed.
|
|
||||||
@testtools.skip(
|
|
||||||
'Skip because of the bug '
|
|
||||||
'https://bugs.launchpad.net/python-openstackclient/+bug/1608903')
|
|
||||||
def test_network_rbac_set(self):
|
def test_network_rbac_set(self):
|
||||||
opts = self.get_opts(self.FIELDS)
|
opts = self.get_opts(self.FIELDS)
|
||||||
project_id = self.openstack(
|
project_id = self.openstack(
|
||||||
'project create ' + self.PROJECT_NAME + opts)
|
'project create ' + self.PROJECT_NAME + opts)
|
||||||
self.openstack('network rbac set ' + self.ID +
|
self.openstack('network rbac set ' + self.ID +
|
||||||
' --target-project ' + self.PROJECT_NAME)
|
' --target-project ' + self.PROJECT_NAME)
|
||||||
opts = self.get_opts(['target_project'])
|
opts = self.get_opts(['target_project_id'])
|
||||||
raw_output_rbac = self.openstack('network rbac show ' + self.ID + opts)
|
raw_output_rbac = self.openstack('network rbac show ' + self.ID + opts)
|
||||||
raw_output_project = self.openstack(
|
raw_output_project = self.openstack(
|
||||||
'project delete ' + self.PROJECT_NAME)
|
'project delete ' + self.PROJECT_NAME)
|
||||||
|
@ -33,7 +33,7 @@ def _get_columns(item):
|
|||||||
columns.append('project_id')
|
columns.append('project_id')
|
||||||
if 'target_tenant' in columns:
|
if 'target_tenant' in columns:
|
||||||
columns.remove('target_tenant')
|
columns.remove('target_tenant')
|
||||||
columns.append('target_project')
|
columns.append('target_project_id')
|
||||||
return tuple(sorted(columns))
|
return tuple(sorted(columns))
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ class FakeNetworkRBAC(object):
|
|||||||
loaded=True)
|
loaded=True)
|
||||||
# Set attributes with special mapping in OpenStack SDK.
|
# Set attributes with special mapping in OpenStack SDK.
|
||||||
rbac.project_id = rbac_attrs['tenant_id']
|
rbac.project_id = rbac_attrs['tenant_id']
|
||||||
rbac.target_project = rbac_attrs['target_tenant']
|
rbac.target_project_id = rbac_attrs['target_tenant']
|
||||||
return rbac
|
return rbac
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -49,7 +49,7 @@ class TestCreateNetworkRBAC(TestNetworkRBAC):
|
|||||||
'object_id',
|
'object_id',
|
||||||
'object_type',
|
'object_type',
|
||||||
'project_id',
|
'project_id',
|
||||||
'target_project',
|
'target_project_id',
|
||||||
)
|
)
|
||||||
|
|
||||||
data = [
|
data = [
|
||||||
@ -383,7 +383,7 @@ class TestShowNetworkRBAC(TestNetworkRBAC):
|
|||||||
'object_id',
|
'object_id',
|
||||||
'object_type',
|
'object_type',
|
||||||
'project_id',
|
'project_id',
|
||||||
'target_project',
|
'target_project_id',
|
||||||
)
|
)
|
||||||
|
|
||||||
data = [
|
data = [
|
||||||
|
Loading…
Reference in New Issue
Block a user