Command docs: domain
Change the implementation of --enable|--disable on domain create and set commands to our usual style. Change-Id: I10f2b96281a114fa3cf3b001394844770b2a8632
This commit is contained in:
parent
be8cac9cea
commit
f18f264ed7
@ -36,7 +36,7 @@ Create new domain
|
|||||||
|
|
||||||
If the domain already exists, return the existing domain data and do not fail.
|
If the domain already exists, return the existing domain data and do not fail.
|
||||||
|
|
||||||
.. option:: <domain-name>
|
.. describe:: <domain-name>
|
||||||
|
|
||||||
New domain name
|
New domain name
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ Delete domain
|
|||||||
os domain delete
|
os domain delete
|
||||||
<domain>
|
<domain>
|
||||||
|
|
||||||
.. option:: <domain>
|
.. describe:: <domain>
|
||||||
|
|
||||||
Domain to delete (name or ID)
|
Domain to delete (name or ID)
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ Set domain properties
|
|||||||
|
|
||||||
Disable domain
|
Disable domain
|
||||||
|
|
||||||
.. option:: <domain>
|
.. describe:: <domain>
|
||||||
|
|
||||||
Domain to modify (name or ID)
|
Domain to modify (name or ID)
|
||||||
|
|
||||||
@ -110,6 +110,6 @@ Show domain details
|
|||||||
os domain show
|
os domain show
|
||||||
<domain>
|
<domain>
|
||||||
|
|
||||||
.. option:: <domain>
|
.. describe:: <domain>
|
||||||
|
|
||||||
Domain to display (name or ID)
|
Domain to display (name or ID)
|
||||||
|
@ -78,7 +78,7 @@ referring to both Compute and Volume quotas.
|
|||||||
* ``consumer``: Identity - OAuth-based delegatee
|
* ``consumer``: Identity - OAuth-based delegatee
|
||||||
* ``container``: Object Store - a grouping of objects
|
* ``container``: Object Store - a grouping of objects
|
||||||
* ``credentials``: (**Identity**) specific to identity providers
|
* ``credentials``: (**Identity**) specific to identity providers
|
||||||
* ``domain``: Identity - a grouping of projects
|
* ``domain``: (**Identity**) a grouping of projects
|
||||||
* ``endpoint``: (**Identity**) the base URL used to contact a specific service
|
* ``endpoint``: (**Identity**) the base URL used to contact a specific service
|
||||||
* ``extension``: (**Compute**, **Identity**, **Volume**) OpenStack server API extensions
|
* ``extension``: (**Compute**, **Identity**, **Volume**) OpenStack server API extensions
|
||||||
* ``flavor``: Compute - pre-defined configurations of servers: ram, root disk, etc
|
* ``flavor``: Compute - pre-defined configurations of servers: ram, root disk, etc
|
||||||
|
@ -48,15 +48,14 @@ class CreateDomain(show.ShowOne):
|
|||||||
enable_group = parser.add_mutually_exclusive_group()
|
enable_group = parser.add_mutually_exclusive_group()
|
||||||
enable_group.add_argument(
|
enable_group.add_argument(
|
||||||
'--enable',
|
'--enable',
|
||||||
dest='enabled',
|
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=True,
|
help='Enable domain (default)',
|
||||||
help='Enable domain')
|
)
|
||||||
enable_group.add_argument(
|
enable_group.add_argument(
|
||||||
'--disable',
|
'--disable',
|
||||||
dest='enabled',
|
action='store_true',
|
||||||
action='store_false',
|
help='Disable domain',
|
||||||
help='Disable domain')
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--or-show',
|
'--or-show',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
@ -68,11 +67,15 @@ class CreateDomain(show.ShowOne):
|
|||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
|
enabled = True
|
||||||
|
if parsed_args.disable:
|
||||||
|
enabled = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
domain = identity_client.domains.create(
|
domain = identity_client.domains.create(
|
||||||
name=parsed_args.name,
|
name=parsed_args.name,
|
||||||
description=parsed_args.description,
|
description=parsed_args.description,
|
||||||
enabled=parsed_args.enabled,
|
enabled=enabled,
|
||||||
)
|
)
|
||||||
except ksc_exc.Conflict as e:
|
except ksc_exc.Conflict as e:
|
||||||
if parsed_args.or_show:
|
if parsed_args.or_show:
|
||||||
@ -150,13 +153,11 @@ class SetDomain(command.Command):
|
|||||||
enable_group = parser.add_mutually_exclusive_group()
|
enable_group = parser.add_mutually_exclusive_group()
|
||||||
enable_group.add_argument(
|
enable_group.add_argument(
|
||||||
'--enable',
|
'--enable',
|
||||||
dest='enabled',
|
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Enable domain',
|
help='Enable domain',
|
||||||
)
|
)
|
||||||
enable_group.add_argument(
|
enable_group.add_argument(
|
||||||
'--disable',
|
'--disable',
|
||||||
dest='disabled',
|
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Disable domain',
|
help='Disable domain',
|
||||||
)
|
)
|
||||||
@ -172,9 +173,10 @@ class SetDomain(command.Command):
|
|||||||
kwargs['name'] = parsed_args.name
|
kwargs['name'] = parsed_args.name
|
||||||
if parsed_args.description:
|
if parsed_args.description:
|
||||||
kwargs['description'] = parsed_args.description
|
kwargs['description'] = parsed_args.description
|
||||||
if parsed_args.enabled:
|
|
||||||
|
if parsed_args.enable:
|
||||||
kwargs['enabled'] = True
|
kwargs['enabled'] = True
|
||||||
if parsed_args.disabled:
|
if parsed_args.disable:
|
||||||
kwargs['enabled'] = False
|
kwargs['enabled'] = False
|
||||||
|
|
||||||
if not kwargs:
|
if not kwargs:
|
||||||
|
@ -46,7 +46,6 @@ class TestDomainCreate(TestDomain):
|
|||||||
identity_fakes.domain_name,
|
identity_fakes.domain_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('enabled', True),
|
|
||||||
('name', identity_fakes.domain_name),
|
('name', identity_fakes.domain_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -81,7 +80,6 @@ class TestDomainCreate(TestDomain):
|
|||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('description', 'new desc'),
|
('description', 'new desc'),
|
||||||
('enabled', True),
|
|
||||||
('name', identity_fakes.domain_name),
|
('name', identity_fakes.domain_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -115,7 +113,7 @@ class TestDomainCreate(TestDomain):
|
|||||||
identity_fakes.domain_name,
|
identity_fakes.domain_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('enabled', True),
|
('enable', True),
|
||||||
('name', identity_fakes.domain_name),
|
('name', identity_fakes.domain_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -149,7 +147,7 @@ class TestDomainCreate(TestDomain):
|
|||||||
identity_fakes.domain_name,
|
identity_fakes.domain_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('enabled', False),
|
('disable', True),
|
||||||
('name', identity_fakes.domain_name),
|
('name', identity_fakes.domain_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -333,7 +331,7 @@ class TestDomainSet(TestDomain):
|
|||||||
identity_fakes.domain_id,
|
identity_fakes.domain_id,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('enabled', True),
|
('enable', True),
|
||||||
('domain', identity_fakes.domain_id),
|
('domain', identity_fakes.domain_id),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -356,7 +354,7 @@ class TestDomainSet(TestDomain):
|
|||||||
identity_fakes.domain_id,
|
identity_fakes.domain_id,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('disabled', True),
|
('disable', True),
|
||||||
('domain', identity_fakes.domain_id),
|
('domain', identity_fakes.domain_id),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user