fix confused domain argument for network create v2
we have used domain scope arguments --project-domain, --user-domain and --group-domain in identity commands, for example, role add v3, to prevent resources conflict from same resource name existence. To keep with the style of identity commands, it's better to rename --domain to --project-domain. Closes-Bug: #1468988 Change-Id: Ic6ccb895cf9be4a3d5f0001525e3b80cd340da8b
This commit is contained in:
parent
ec31a2a12e
commit
8899bc4162
@ -13,20 +13,20 @@ Create new network
|
||||
.. code:: bash
|
||||
|
||||
os network create
|
||||
[--domain <domain>]
|
||||
[--project <project> [--project-domain <project-domain>]]
|
||||
[--enable | --disable]
|
||||
[--project <project>]
|
||||
[--share | --no-share]
|
||||
<name>
|
||||
|
||||
.. option:: --domain <domain>
|
||||
|
||||
Owner's domain (name or ID)
|
||||
|
||||
.. option:: --project <project>
|
||||
|
||||
Owner's project (name or ID)
|
||||
|
||||
.. option:: --project-domain <project-domain>
|
||||
|
||||
Domain the project belongs to (name or ID).
|
||||
This can be used in case collisions between project names exist.
|
||||
|
||||
.. option:: --enable
|
||||
|
||||
Enable network (default)
|
||||
|
@ -87,10 +87,7 @@ class CreateNetwork(show.ShowOne):
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
help="Owner's project (name or ID)")
|
||||
parser.add_argument(
|
||||
'--domain',
|
||||
metavar='<domain>',
|
||||
help="Owner's domain (name or ID)")
|
||||
identity_common.add_project_domain_option_to_parser(parser)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -112,15 +109,11 @@ class CreateNetwork(show.ShowOne):
|
||||
body['shared'] = parsed_args.shared
|
||||
if parsed_args.project is not None:
|
||||
identity_client = self.app.client_manager.identity
|
||||
if parsed_args.domain is not None:
|
||||
domain = identity_common.find_domain(identity_client,
|
||||
parsed_args.domain)
|
||||
project_id = utils.find_resource(identity_client.projects,
|
||||
parsed_args.project,
|
||||
domain_id=domain.id).id
|
||||
else:
|
||||
project_id = utils.find_resource(identity_client.projects,
|
||||
parsed_args.project).id
|
||||
project_id = identity_common.find_project(
|
||||
identity_client,
|
||||
parsed_args.project,
|
||||
parsed_args.project_domain,
|
||||
).id
|
||||
body['tenant_id'] = project_id
|
||||
return {'network': body}
|
||||
|
||||
|
@ -90,14 +90,14 @@ class TestCreateNetwork(common.TestNetworkBase):
|
||||
"--disable",
|
||||
"--share",
|
||||
"--project", identity_fakes_v3.project_name,
|
||||
"--domain", identity_fakes_v3.domain_name,
|
||||
"--project-domain", identity_fakes_v3.domain_name,
|
||||
FAKE_NAME,
|
||||
] + self.given_show_options
|
||||
verifylist = [
|
||||
('admin_state', False),
|
||||
('shared', True),
|
||||
('project', identity_fakes_v3.project_name),
|
||||
('domain', identity_fakes_v3.domain_name),
|
||||
('project_domain', identity_fakes_v3.domain_name),
|
||||
('name', FAKE_NAME),
|
||||
] + self.then_show_options
|
||||
mocker = mock.Mock(return_value=copy.deepcopy(RESPONSE))
|
||||
@ -165,7 +165,6 @@ class TestCreateNetwork(common.TestNetworkBase):
|
||||
arglist = [
|
||||
"--project", identity_fakes_v2.project_name,
|
||||
FAKE_NAME,
|
||||
|
||||
]
|
||||
verifylist = [
|
||||
('admin_state', True),
|
||||
@ -203,14 +202,14 @@ class TestCreateNetwork(common.TestNetworkBase):
|
||||
def test_create_with_domain_identityv2(self):
|
||||
arglist = [
|
||||
"--project", identity_fakes_v3.project_name,
|
||||
"--domain", identity_fakes_v3.domain_name,
|
||||
"--project-domain", identity_fakes_v3.domain_name,
|
||||
FAKE_NAME,
|
||||
]
|
||||
verifylist = [
|
||||
('admin_state', True),
|
||||
('shared', None),
|
||||
('project', identity_fakes_v3.project_name),
|
||||
('domain', identity_fakes_v3.domain_name),
|
||||
('project_domain', identity_fakes_v3.domain_name),
|
||||
('name', FAKE_NAME),
|
||||
]
|
||||
mocker = mock.Mock(return_value=copy.deepcopy(RESPONSE))
|
||||
|
Loading…
Reference in New Issue
Block a user