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:
Dean Troyer 2014-12-31 09:54:21 -06:00
parent be8cac9cea
commit f18f264ed7
4 changed files with 22 additions and 22 deletions

View File

@ -36,7 +36,7 @@ Create new domain
If the domain already exists, return the existing domain data and do not fail.
.. option:: <domain-name>
.. describe:: <domain-name>
New domain name
@ -51,7 +51,7 @@ Delete domain
os domain delete
<domain>
.. option:: <domain>
.. describe:: <domain>
Domain to delete (name or ID)
@ -95,7 +95,7 @@ Set domain properties
Disable domain
.. option:: <domain>
.. describe:: <domain>
Domain to modify (name or ID)
@ -110,6 +110,6 @@ Show domain details
os domain show
<domain>
.. option:: <domain>
.. describe:: <domain>
Domain to display (name or ID)

View File

@ -78,7 +78,7 @@ referring to both Compute and Volume quotas.
* ``consumer``: Identity - OAuth-based delegatee
* ``container``: Object Store - a grouping of objects
* ``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
* ``extension``: (**Compute**, **Identity**, **Volume**) OpenStack server API extensions
* ``flavor``: Compute - pre-defined configurations of servers: ram, root disk, etc

View File

@ -48,15 +48,14 @@ class CreateDomain(show.ShowOne):
enable_group = parser.add_mutually_exclusive_group()
enable_group.add_argument(
'--enable',
dest='enabled',
action='store_true',
default=True,
help='Enable domain')
help='Enable domain (default)',
)
enable_group.add_argument(
'--disable',
dest='enabled',
action='store_false',
help='Disable domain')
action='store_true',
help='Disable domain',
)
parser.add_argument(
'--or-show',
action='store_true',
@ -68,11 +67,15 @@ class CreateDomain(show.ShowOne):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity
enabled = True
if parsed_args.disable:
enabled = False
try:
domain = identity_client.domains.create(
name=parsed_args.name,
description=parsed_args.description,
enabled=parsed_args.enabled,
enabled=enabled,
)
except ksc_exc.Conflict as e:
if parsed_args.or_show:
@ -150,13 +153,11 @@ class SetDomain(command.Command):
enable_group = parser.add_mutually_exclusive_group()
enable_group.add_argument(
'--enable',
dest='enabled',
action='store_true',
help='Enable domain',
)
enable_group.add_argument(
'--disable',
dest='disabled',
action='store_true',
help='Disable domain',
)
@ -172,9 +173,10 @@ class SetDomain(command.Command):
kwargs['name'] = parsed_args.name
if parsed_args.description:
kwargs['description'] = parsed_args.description
if parsed_args.enabled:
if parsed_args.enable:
kwargs['enabled'] = True
if parsed_args.disabled:
if parsed_args.disable:
kwargs['enabled'] = False
if not kwargs:

View File

@ -46,7 +46,6 @@ class TestDomainCreate(TestDomain):
identity_fakes.domain_name,
]
verifylist = [
('enabled', True),
('name', identity_fakes.domain_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -81,7 +80,6 @@ class TestDomainCreate(TestDomain):
]
verifylist = [
('description', 'new desc'),
('enabled', True),
('name', identity_fakes.domain_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -115,7 +113,7 @@ class TestDomainCreate(TestDomain):
identity_fakes.domain_name,
]
verifylist = [
('enabled', True),
('enable', True),
('name', identity_fakes.domain_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -149,7 +147,7 @@ class TestDomainCreate(TestDomain):
identity_fakes.domain_name,
]
verifylist = [
('enabled', False),
('disable', True),
('name', identity_fakes.domain_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -333,7 +331,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id,
]
verifylist = [
('enabled', True),
('enable', True),
('domain', identity_fakes.domain_id),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -356,7 +354,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id,
]
verifylist = [
('disabled', True),
('disable', True),
('domain', identity_fakes.domain_id),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)