summaryrefslogtreecommitdiff
path: root/keystoneclient/discover.py
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2014-07-17 16:07:04 +1000
committerJamie Lennox <jamielennox@redhat.com>2014-08-21 09:26:24 +1000
commit9cc2f7c73e92ae6c6b4fbf19272bb2f9209f45e7 (patch)
tree07301de2c2620732dda6c513ef41580f399d9e34 /keystoneclient/discover.py
parent4cc17635580e189d5d90300ecf5af1536cb666be (diff)
downloadpython-keystoneclient-9cc2f7c73e92ae6c6b4fbf19272bb2f9209f45e7.tar.gz
Allow unauthenticated discovery
The default state for session requests is that if there is an auth plugin available then it should include a token in any requests. This is a problem for cases where it is the authentication plugin itself trying to do discovery (like in the case of version independent plugins) because you end up in an infinite loop. Allow controlling the authenticated parameter on discovery requests. Closes-Bug: #1359457 Change-Id: Ib5ab0a3a30fe79139b7b5dcaae698438281b6d36
Diffstat (limited to 'keystoneclient/discover.py')
-rw-r--r--keystoneclient/discover.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/keystoneclient/discover.py b/keystoneclient/discover.py
index 7d8e1ed..07de97d 100644
--- a/keystoneclient/discover.py
+++ b/keystoneclient/discover.py
@@ -17,6 +17,7 @@ import six
from keystoneclient import _discover
from keystoneclient import exceptions
from keystoneclient import session as client_session
+from keystoneclient import utils
from keystoneclient.v2_0 import client as v2_client
from keystoneclient.v3 import client as v3_client
@@ -44,7 +45,8 @@ class Discover(_discover.Discover):
operates upon the data that was retrieved.
"""
- def __init__(self, session=None, **kwargs):
+ @utils.positional(2)
+ def __init__(self, session=None, authenticated=None, **kwargs):
"""Construct a new discovery object.
The connection parameters associated with this method are the same
@@ -98,6 +100,10 @@ class Discover(_discover.Discover):
service. default: False (optional)
DEPRECATED: use the session object. This is
ignored if a session is provided.
+ :param bool authenticated: Should a token be used to perform the
+ initial discovery operations.
+ default: None (attach a token if an auth
+ plugin is available).
"""
if not session:
@@ -121,7 +127,8 @@ class Discover(_discover.Discover):
'auth_url or endpoint')
self._client_kwargs = kwargs
- super(Discover, self).__init__(session, url)
+ super(Discover, self).__init__(session, url,
+ authenticated=authenticated)
def available_versions(self, **kwargs):
"""Return a list of identity APIs available on the server and the data