Add backwards compat for edit_managed/all_tenants

edit_managed/all_tenants were moved from get_session
to the Client constructor, we should support both
for a period of time.

Change-Id: I2e3d74168976868ea1e4dd6c797f6340faa50d0f
This commit is contained in:
Kiall Mac Innes 2015-06-19 10:02:34 +01:00
parent 4eb1c541d6
commit b57328dc8f
3 changed files with 28 additions and 5 deletions

View File

@ -18,7 +18,7 @@ import json
import os import os
import uuid import uuid
from debtcollector import removals
from keystoneclient.auth.identity import generic from keystoneclient.auth.identity import generic
from keystoneclient.auth import token_endpoint from keystoneclient.auth import token_endpoint
from keystoneclient import session as ks_session from keystoneclient import session as ks_session
@ -98,10 +98,15 @@ def get_columns(data):
return list(columns) return list(columns)
@removals.removed_kwarg('all_tenants', removal_version='1.3.0')
@removals.removed_kwarg('edit_managed', removal_version='1.3.0')
def get_session(auth_url, endpoint, domain_id, domain_name, project_id, def get_session(auth_url, endpoint, domain_id, domain_name, project_id,
project_name, project_domain_name, project_domain_id, username, project_name, project_domain_name, project_domain_id, username,
user_id, password, user_domain_id, user_domain_name, token, user_id, password, user_domain_id, user_domain_name, token,
insecure, cacert): insecure, cacert, all_tenants=None, edit_managed=None):
# NOTE: all_tenants and edit_managed are here for backwards compat
# reasons, do not add additional modifiers here.
session = ks_session.Session() session = ks_session.Session()
# Build + Attach Authentication Plugin # Build + Attach Authentication Plugin
@ -140,6 +145,11 @@ def get_session(auth_url, endpoint, domain_id, domain_name, project_id,
else: else:
session.verify = cacert session.verify = cacert
# NOTE: all_tenants and edit_managed are here for backwards compat
# reasons, do not add additional modifiers here.
session.all_tenants = all_tenants
session.edit_managed = edit_managed
return session return session

View File

@ -32,7 +32,7 @@ class Client(object):
project_domain_id=None, auth_url=None, token=None, project_domain_id=None, auth_url=None, token=None,
endpoint_type='publicURL', region_name=None, endpoint_type='publicURL', region_name=None,
service_type='dns', insecure=False, session=None, service_type='dns', insecure=False, session=None,
cacert=None, all_tenants=False, edit_managed=False): cacert=None, all_tenants=None, edit_managed=None):
""" """
:param endpoint: Endpoint URL :param endpoint: Endpoint URL
:param token: A token instead of username / password :param token: A token instead of username / password
@ -65,7 +65,19 @@ class Client(object):
cacert=cacert cacert=cacert
) )
# NOTE: all_tenants and edit_managed are pulled from the session for
# backwards compat reasons, do not pull additional modifiers from
# here. Once removed, the kwargs above should default to False.
if all_tenants is None:
self.all_tenants = getattr(self.session.session, 'all_tenants',
False)
else:
self.all_tenants = all_tenants self.all_tenants = all_tenants
if edit_managed is None:
self.edit_managed = getattr(self.session.session, 'edit_managed',
False)
else:
self.edit_managed = edit_managed self.edit_managed = edit_managed
# Since we have to behave nicely like a legacy client/bindings we use # Since we have to behave nicely like a legacy client/bindings we use

View File

@ -9,3 +9,4 @@ python-keystoneclient>=1.6.0
requests>=2.5.2 requests>=2.5.2
six>=1.9.0 six>=1.9.0
stevedore>=1.5.0 # Apache-2.0 stevedore>=1.5.0 # Apache-2.0
debtcollector>=0.3.0 # Apache-2.0