From 77ff011ced18260242224a7317aba92d53ff1455 Mon Sep 17 00:00:00 2001 From: Kristi Nikolla Date: Fri, 16 Jun 2017 15:04:40 -0400 Subject: Add domain parameter to Identity Provider Identity providers are now associated with domains. This change allows a user to specify a domain by ID or by name when creating an identity provider. [0] This also adds the column for Domain ID in listing. Updating a domain for an identity provider is not supported, so that isn't changed. [0]. Id18b8b2fe853b97631bc990df8188ed64a6e1275 Closes-Bug: 1698390 Change-Id: Icc408e2fe88f257d5863bd3df716a777d52befcc --- openstackclient/identity/v3/identity_provider.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'openstackclient/identity/v3') diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py index e8b3a2f4..d8951d31 100644 --- a/openstackclient/identity/v3/identity_provider.py +++ b/openstackclient/identity/v3/identity_provider.py @@ -21,6 +21,7 @@ from osc_lib import utils import six from openstackclient.i18n import _ +from openstackclient.identity import common LOG = logging.getLogger(__name__) @@ -55,6 +56,13 @@ class CreateIdentityProvider(command.ShowOne): metavar='', help=_('New identity provider description'), ) + parser.add_argument( + '--domain', + metavar='', + help=_('Domain to associate with the identity provider. If not ' + 'specified, a domain will be created automatically. ' + '(Name or ID)'), + ) enable_identity_provider = parser.add_mutually_exclusive_group() enable_identity_provider.add_argument( '--enable', @@ -81,10 +89,17 @@ class CreateIdentityProvider(command.ShowOne): else: remote_ids = (parsed_args.remote_id if parsed_args.remote_id else None) + + domain_id = None + if parsed_args.domain: + domain_id = common.find_domain(identity_client, + parsed_args.domain).id + idp = identity_client.federation.identity_providers.create( id=parsed_args.identity_provider_id, remote_ids=remote_ids, description=parsed_args.description, + domain_id=domain_id, enabled=parsed_args.enabled) idp._info.pop('links', None) @@ -129,7 +144,7 @@ class ListIdentityProvider(command.Lister): _description = _("List identity providers") def take_action(self, parsed_args): - columns = ('ID', 'Enabled', 'Description') + columns = ('ID', 'Enabled', 'Domain ID', 'Description') identity_client = self.app.client_manager.identity data = identity_client.federation.identity_providers.list() return (columns, -- cgit v1.2.1