Skip to content

Instantly share code, notes, and snippets.

@knikolla
Created March 21, 2016 14:27
Show Gist options
  • Select an option

  • Save knikolla/5985bd18e2f075d9e3af to your computer and use it in GitHub Desktop.

Select an option

Save knikolla/5985bd18e2f075d9e3af to your computer and use it in GitHub Desktop.
[knikolla@lenovo-moc1 k2k-openstackclient]$ git diff master..k2k
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py
index 56ddcba..0295116 100644
--- a/openstackclient/common/clientmanager.py
+++ b/openstackclient/common/clientmanager.py
@@ -205,6 +205,31 @@ class ClientManager(object):
if not self._auth_ref:
self.setup_auth()
LOG.debug("Get auth_ref")
+
+ if self._cli_options.os_service_provider:
+ from keystoneauth1 import identity
+ from keystoneauth1 import session as ks
+ from keystoneauth1.identity.v3.k2k import Keystone2Keystone
+
+ idp_auth = identity.Password(auth_url=self._auth_params['auth_url'],
+ username=self._auth_params['username'],
+ password=self._auth_params['password'],
+ project_name=self._auth_params[
+ 'project_name'],
+ project_domain_id=self._auth_params[
+ 'project_domain_id'],
+ user_domain_id=self._auth_params[
+ 'user_domain_id'])
+
+ self.auth = Keystone2Keystone(idp_auth,
+ self._cli_options.os_service_provider,
+ project_name=self._auth_params[
+ 'project_name'],
+ project_domain_id=self._auth_params[
+ 'project_domain_id'])
+
+ self.session = ks.Session(auth=self.auth)
+
self._auth_ref = self.auth.get_auth_ref(self.session)
return self._auth_ref
@@ -239,7 +264,7 @@ class ClientManager(object):
endpoint = self.auth_ref.service_catalog.url_for(
service_type=service_type,
region_name=region_name,
- endpoint_type=interface,
+ #endpoint_type=interface,
)
else:
# Get the passed endpoint directly from the auth plugin
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 7750f2a..9d551d4 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -227,6 +227,13 @@ class OpenStackShell(app.App):
action='store_true',
help="Print API call timing info",
)
+ parser.add_argument(
+ '--os-service-provider',
+ metavar='<os_service_provider>',
+ dest='os_service_provider',
+ default=None,
+ help='Federated Service Provider ID'
+ )
# osprofiler HMAC key argument
if osprofiler_profiler:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment