diff --git a/designateclient/utils.py b/designateclient/utils.py index ae53295..119b35e 100644 --- a/designateclient/utils.py +++ b/designateclient/utils.py @@ -18,7 +18,7 @@ import json import os import uuid - +from debtcollector import removals from keystoneclient.auth.identity import generic from keystoneclient.auth import token_endpoint from keystoneclient import session as ks_session @@ -98,10 +98,15 @@ def get_columns(data): 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, project_name, project_domain_name, project_domain_id, username, 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() # Build + Attach Authentication Plugin @@ -140,6 +145,11 @@ def get_session(auth_url, endpoint, domain_id, domain_name, project_id, else: 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 diff --git a/designateclient/v1/__init__.py b/designateclient/v1/__init__.py index 854bccc..73fef35 100644 --- a/designateclient/v1/__init__.py +++ b/designateclient/v1/__init__.py @@ -32,7 +32,7 @@ class Client(object): project_domain_id=None, auth_url=None, token=None, endpoint_type='publicURL', region_name=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 token: A token instead of username / password @@ -65,8 +65,20 @@ class Client(object): cacert=cacert ) - self.all_tenants = all_tenants - self.edit_managed = edit_managed + # 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 + + if edit_managed is None: + self.edit_managed = getattr(self.session.session, 'edit_managed', + False) + else: + self.edit_managed = edit_managed # Since we have to behave nicely like a legacy client/bindings we use # an adapter around the session to not modify it's state. diff --git a/requirements.txt b/requirements.txt index e941bb4..733bee9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ python-keystoneclient>=1.6.0 requests>=2.5.2 six>=1.9.0 stevedore>=1.5.0 # Apache-2.0 +debtcollector>=0.3.0 # Apache-2.0