Remove now unused and not needed OpenStackAuthConnection class.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/45d8a344 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/45d8a344 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/45d8a344 Branch: refs/heads/trunk Commit: 45d8a344146eded2c7fa652e250a724eb921e795 Parents: 44945ed Author: Tomaz Muraus <to...@apache.org> Authored: Wed Aug 13 16:30:20 2014 +0200 Committer: Tomaz Muraus <to...@apache.org> Committed: Wed Aug 13 16:34:11 2014 +0200 ---------------------------------------------------------------------- libcloud/common/openstack_identity.py | 81 ------------------------------ 1 file changed, 81 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/45d8a344/libcloud/common/openstack_identity.py ---------------------------------------------------------------------- diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py index 0e11a0b..52e17e0 100644 --- a/libcloud/common/openstack_identity.py +++ b/libcloud/common/openstack_identity.py @@ -683,87 +683,6 @@ class OpenStackIdentityConnection(ConnectionUserAndKey): return True -class OpenStackAuthConnection(OpenStackIdentityConnection): - """ - Note: This class is only here for backward compatibility reasons. - """ - responseCls = OpenStackAuthResponse - name = 'OpenStack Auth' - timeout = None - - def __init__(self, parent_conn, auth_url, auth_version, user_id, key, - tenant_name=None, timeout=None): - super(OpenStackAuthConnection, self).__init__(auth_url=auth_url, - user_id=user_id, - key=key, - tenant_name=tenant_name, - timeout=timeout, - parent_conn=parent_conn) - self.auth_version = auth_version - self._instance_cache = {} - - def _get_cls_for_auth_version(self, auth_version): - if auth_version == '1.0': - cls = OpenStackIdentity_1_0_Connection - elif auth_version == '1.1': - cls = OpenStackIdentity_1_1_Connection - elif auth_version == '2.0' or auth_version == '2.0_apikey': - cls = OpenStackIdentity_2_0_Connection - elif auth_version == '2.0_password': - cls = OpenStackIdentity_2_0_Connection - elif auth_version == '3.x_password': - cls = OpenStackIdentity_3_0_Connection - else: - raise LibcloudError('Unsupported Auth Version requested') - - return cls - - def _get_instance_for_auth_version(self, auth_version): - """ - Retrieve instance for the provided auth version for the local cache (if - exists). - """ - # TODO: Just delegate to the new classes - kwargs = {'auth_url': self.auth_url, 'user_id': self.user_id, - 'key': self.key, 'tenant_name': self.tenant_name, - 'timeout': self.timeout, 'parent_conn': self.parent_conn} - - cls = self._get_cls_for_auth_version(auth_version=auth_version) - - if auth_version not in self._instance_cache: - obj = cls(**kwargs) - self._instance_cache[auth_version] = obj - - return self._instance_cache[auth_version] - - def authenticate(self, force=False): - """ - Authenticate against the keystone api. - - :param force: Forcefully update the token even if it's already cached - and still valid. - :type force: ``bool`` - """ - if not self._is_authentication_needed(force=force): - return self - - obj = self._get_instance_for_auth_version( - auth_version=self.auth_version) - - try: - obj.authenticate() - finally: - self.action = obj.action - - # For backward compatibility, re-assign attributes to this class - self.auth_token = obj.auth_token - self.auth_token_expires = obj.auth_token_expires - self.urls = obj.urls - self.auth_user_info = obj.auth_user_info - - return self - - class OpenStackIdentity_1_0_Connection(OpenStackIdentityConnection): """ Connection class for Keystone API v1.0.