Removes py26 support
We are removing Python 2.6 support from the Keystone libraries. Change-Id: I1c7a79edd41a73946c9d77bfb8cd2075e2500760 Closes-Bug: 1519449
This commit is contained in:
@@ -27,6 +27,7 @@ Identity V2 and V3 clients can also be created directly. See
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pbr.version
|
import pbr.version
|
||||||
@@ -67,10 +68,9 @@ class _LazyImporter(object):
|
|||||||
'v2_0',
|
'v2_0',
|
||||||
'v3',
|
'v3',
|
||||||
]
|
]
|
||||||
# __import__ rather than importlib for Python 2.6.
|
|
||||||
if name in lazy_submodules:
|
if name in lazy_submodules:
|
||||||
__import__('keystoneclient.%s' % name)
|
return importlib.import_module('keystoneclient.%s' % name)
|
||||||
return getattr(self, name)
|
|
||||||
# Return module attributes like __all__ etc.
|
# Return module attributes like __all__ etc.
|
||||||
return getattr(self._module, name)
|
return getattr(self._module, name)
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ def _process_communicate_handle_oserror(process, data, files):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno != errno.EPIPE:
|
if e.errno != errno.EPIPE:
|
||||||
raise
|
raise
|
||||||
# OSError with EPIPE only occurs with Python 2.6.x/old 2.7.x
|
# OSError with EPIPE only occurs with old Python 2.7.x versions
|
||||||
# http://bugs.python.org/issue10963
|
# http://bugs.python.org/issue10963
|
||||||
|
|
||||||
# The quick exit is typically caused by the openssl command not being
|
# The quick exit is typically caused by the openssl command not being
|
||||||
@@ -191,11 +191,7 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name,
|
|||||||
else:
|
else:
|
||||||
raise exceptions.CertificateConfigError(err)
|
raise exceptions.CertificateConfigError(err)
|
||||||
elif retcode != OpensslCmsExitStatus.SUCCESS:
|
elif retcode != OpensslCmsExitStatus.SUCCESS:
|
||||||
# NOTE(dmllr): Python 2.6 compatibility:
|
raise subprocess.CalledProcessError(retcode, 'openssl', output=err)
|
||||||
# CalledProcessError did not have output keyword argument
|
|
||||||
e = subprocess.CalledProcessError(retcode, 'openssl')
|
|
||||||
e.output = err
|
|
||||||
raise e
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ import datetime
|
|||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from testtools import testcase
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
from keystoneclient.tests.unit.v2_0 import utils
|
from keystoneclient.tests.unit.v2_0 import utils
|
||||||
@@ -91,17 +92,13 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
|
|
||||||
self.stub_auth(status_code=401, json=error)
|
self.stub_auth(status_code=401, json=error)
|
||||||
|
|
||||||
# Workaround for issue with assertRaises on python2.6
|
with testcase.ExpectedException(exceptions.Unauthorized):
|
||||||
# where with assertRaises(exceptions.Unauthorized): doesn't work
|
|
||||||
# right
|
|
||||||
def client_create_wrapper():
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
client.Client(username=self.TEST_USER,
|
client.Client(username=self.TEST_USER,
|
||||||
password="bad_key",
|
password="bad_key",
|
||||||
project_id=self.TEST_TENANT_ID,
|
project_id=self.TEST_TENANT_ID,
|
||||||
auth_url=self.TEST_URL)
|
auth_url=self.TEST_URL)
|
||||||
|
|
||||||
self.assertRaises(exceptions.Unauthorized, client_create_wrapper)
|
|
||||||
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
|
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
|
||||||
|
|
||||||
def test_auth_redirect(self):
|
def test_auth_redirect(self):
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from testtools import testcase
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
from keystoneclient.tests.unit.v3 import utils
|
from keystoneclient.tests.unit.v3 import utils
|
||||||
@@ -103,11 +104,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
|
|
||||||
self.stub_auth(status_code=401, json=error)
|
self.stub_auth(status_code=401, json=error)
|
||||||
|
|
||||||
# Workaround for issue with assertRaises on python2.6
|
with testcase.ExpectedException(exceptions.Unauthorized):
|
||||||
# where with assertRaises(exceptions.Unauthorized): doesn't work
|
|
||||||
# right
|
|
||||||
def client_create_wrapper():
|
|
||||||
# Creating a HTTPClient not using session is deprecated.
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
|
client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
|
||||||
username=self.TEST_USER,
|
username=self.TEST_USER,
|
||||||
@@ -115,7 +112,6 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
project_id=self.TEST_TENANT_ID,
|
project_id=self.TEST_TENANT_ID,
|
||||||
auth_url=self.TEST_URL)
|
auth_url=self.TEST_URL)
|
||||||
|
|
||||||
self.assertRaises(exceptions.Unauthorized, client_create_wrapper)
|
|
||||||
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
|
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
|
||||||
|
|
||||||
def test_auth_redirect(self):
|
def test_auth_redirect(self):
|
||||||
|
@@ -15,7 +15,6 @@ classifier =
|
|||||||
Programming Language :: Python
|
Programming Language :: Python
|
||||||
Programming Language :: Python :: 2
|
Programming Language :: Python :: 2
|
||||||
Programming Language :: Python :: 2.7
|
Programming Language :: Python :: 2.7
|
||||||
Programming Language :: Python :: 2.6
|
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.4
|
Programming Language :: Python :: 3.4
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user