diff --git a/doc/source/command-objects/domain.rst b/doc/source/command-objects/domain.rst index 057296ac5e..66697ac3ea 100644 --- a/doc/source/command-objects/domain.rst +++ b/doc/source/command-objects/domain.rst @@ -36,7 +36,7 @@ Create new domain If the domain already exists, return the existing domain data and do not fail. -.. option:: +.. describe:: New domain name @@ -51,7 +51,7 @@ Delete domain os domain delete -.. option:: +.. describe:: Domain to delete (name or ID) @@ -95,7 +95,7 @@ Set domain properties Disable domain -.. option:: +.. describe:: Domain to modify (name or ID) @@ -110,6 +110,6 @@ Show domain details os domain show -.. option:: +.. describe:: Domain to display (name or ID) diff --git a/doc/source/commands.rst b/doc/source/commands.rst index 04c451c8fb..f82d307ea2 100644 --- a/doc/source/commands.rst +++ b/doc/source/commands.rst @@ -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 diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py index 727f5b1838..189f097052 100644 --- a/openstackclient/identity/v3/domain.py +++ b/openstackclient/identity/v3/domain.py @@ -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: diff --git a/openstackclient/tests/identity/v3/test_domain.py b/openstackclient/tests/identity/v3/test_domain.py index 8dad5bcc7a..cfec10e7c3 100644 --- a/openstackclient/tests/identity/v3/test_domain.py +++ b/openstackclient/tests/identity/v3/test_domain.py @@ -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)