Browse Source

Merge "Show deprecation warning and limit features for KSC session"

Jenkins 2 years ago
parent
commit
946278d98c
1 changed files with 15 additions and 4 deletions
  1. 15
    4
      keystoneauth1/adapter.py

+ 15
- 4
keystoneauth1/adapter.py View File

@@ -11,9 +11,12 @@
11 11
 # under the License.
12 12
 
13 13
 import os
14
+import warnings
14 15
 
15 16
 from positional import positional
16 17
 
18
+from keystoneauth1 import session
19
+
17 20
 
18 21
 class Adapter(object):
19 22
     """An instance of a session with local variables.
@@ -119,10 +122,18 @@ class Adapter(object):
119 122
             kwargs.setdefault('logger', self.logger)
120 123
         if self.allow:
121 124
             kwargs.setdefault('allow', self.allow)
122
-        if self.client_name:
123
-            kwargs.setdefault('client_name', self.client_name)
124
-        if self.client_version:
125
-            kwargs.setdefault('client_version', self.client_version)
125
+
126
+        if isinstance(self.session, session.Session):
127
+            # these things are unsupported by keystoneclient's session so be
128
+            # careful with them until everyone has transitioned to ksa.
129
+            if self.client_name:
130
+                kwargs.setdefault('client_name', self.client_name)
131
+            if self.client_version:
132
+                kwargs.setdefault('client_version', self.client_version)
133
+
134
+        else:
135
+            warnings.warn('Using keystoneclient sessions has been deprecated. '
136
+                          'Please update your software to use keystoneauth1.')
126 137
 
127 138
         for k, v in self.additional_headers.items():
128 139
             kwargs.setdefault('headers', {}).setdefault(k, v)

Loading…
Cancel
Save