summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--babel.cfg1
-rw-r--r--doc/source/conf.py4
-rw-r--r--doc/source/using-api-v2.rst2
-rw-r--r--keystoneclient/discover.py14
-rw-r--r--keystoneclient/httpclient.py37
-rw-r--r--keystoneclient/tests/unit/test_ec2utils.py2
-rw-r--r--keystoneclient/tests/unit/test_session.py2
-rw-r--r--keystoneclient/tests/unit/test_utils.py2
-rw-r--r--keystoneclient/tests/unit/v2_0/client_fixtures.py2
-rw-r--r--keystoneclient/tests/unit/v3/client_fixtures.py2
-rw-r--r--keystoneclient/tests/unit/v3/test_auth.py4
-rw-r--r--keystoneclient/tests/unit/v3/utils.py1
-rw-r--r--keystoneclient/v3/contrib/oauth1/access_tokens.py2
-rw-r--r--keystoneclient/v3/contrib/oauth1/request_tokens.py2
-rw-r--r--lower-constraints.txt3
-rw-r--r--releasenotes/notes/switch-default-interface-v3-dcd7167196ace531.yaml7
-rw-r--r--releasenotes/source/conf.py14
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg13
19 files changed, 60 insertions, 56 deletions
diff --git a/babel.cfg b/babel.cfg
deleted file mode 100644
index efceab8..0000000
--- a/babel.cfg
+++ /dev/null
@@ -1 +0,0 @@
-[python: **.py]
diff --git a/doc/source/conf.py b/doc/source/conf.py
index db0a8c0..9c98458 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -187,8 +187,8 @@ apidoc_excluded_paths = [
# .
latex_documents = [
('index', 'doc-python-keystoneclient.tex',
- u'python-keystoneclient Documentation',
- u'OpenStack', 'manual'),
+ 'python-keystoneclient Documentation',
+ 'OpenStack', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
diff --git a/doc/source/using-api-v2.rst b/doc/source/using-api-v2.rst
index 1b7c5de..7b0815f 100644
--- a/doc/source/using-api-v2.rst
+++ b/doc/source/using-api-v2.rst
@@ -79,7 +79,7 @@ This example will create a tenant named *openstackDemo*::
>>> keystone = client.Client(...)
>>> keystone.tenants.create(tenant_name="openstackDemo",
... description="Default Tenant", enabled=True)
- <Tenant {u'id': u'9b7962da6eb04745b477ae920ad55939', u'enabled': True, u'description': u'Default Tenant', u'name': u'openstackDemo'}>
+ <Tenant {'id': '9b7962da6eb04745b477ae920ad55939', 'enabled': True, 'description': 'Default Tenant', 'name': 'openstackDemo'}>
Creating users
==============
diff --git a/keystoneclient/discover.py b/keystoneclient/discover.py
index 0c129b3..1617416 100644
--- a/keystoneclient/discover.py
+++ b/keystoneclient/discover.py
@@ -232,8 +232,8 @@ class Discover(_discover.Discover):
>>> disc = discover.Discovery(auth_url='http://localhost:5000')
>>> disc.raw_version_data()
[{'id': 'v3.0',
- 'links': [{'href': u'http://127.0.0.1:5000/v3/',
- 'rel': u'self'}],
+ 'links': [{'href': 'http://127.0.0.1:5000/v3/',
+ 'rel': 'self'}],
'media-types': [
{'base': 'application/json',
'type': 'application/vnd.openstack.identity-v3+json'},
@@ -242,11 +242,11 @@ class Discover(_discover.Discover):
'status': 'stable',
'updated': '2013-03-06T00:00:00Z'},
{'id': 'v2.0',
- 'links': [{'href': u'http://127.0.0.1:5000/v2.0/',
- 'rel': u'self'},
- {'href': u'...',
- 'rel': u'describedby',
- 'type': u'application/pdf'}],
+ 'links': [{'href': 'http://127.0.0.1:5000/v2.0/',
+ 'rel': 'self'},
+ {'href': '...',
+ 'rel': 'describedby',
+ 'type': 'application/pdf'}],
'media-types': [
{'base': 'application/json',
'type': 'application/vnd.openstack.identity-v2.0+json'},
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py
index 8d157ce..865af41 100644
--- a/keystoneclient/httpclient.py
+++ b/keystoneclient/httpclient.py
@@ -20,11 +20,18 @@
import logging
import warnings
+try:
+ # For Python 3.8 and later
+ import importlib.metadata as importlib_metadata
+except ImportError:
+ # For everyone else
+ import importlib_metadata
+
from debtcollector import removals
from debtcollector import renames
from keystoneauth1 import adapter
from oslo_serialization import jsonutils
-import pkg_resources
+import packaging.version
import requests
try:
@@ -33,9 +40,10 @@ try:
# NOTE(sdague): The conditional keyring import needs to only
# trigger if it's a version of keyring that's supported in global
# requirements. Update _min and _bad when that changes.
- keyring_v = pkg_resources.parse_version(
- pkg_resources.get_distribution("keyring").version)
- keyring_min = pkg_resources.parse_version('5.5.1')
+ keyring_v = packaging.version.Version(
+ importlib_metadata.version('keyring')
+ )
+ keyring_min = packaging.version.Version('5.5.1')
# This is a list of versions, e.g., pkg_resources.parse_version('3.3')
keyring_bad = []
@@ -43,7 +51,7 @@ try:
import keyring
else:
keyring = None
-except (ImportError, pkg_resources.DistributionNotFound):
+except (ImportError, importlib_metadata.PackageNotFoundError):
keyring = None
pickle = None
@@ -221,7 +229,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
:param string service_name: The default service_name for URL discovery.
default: None (optional)
:param string interface: The default interface for URL discovery.
- default: admin (optional)
+ default: admin (v2), public (v3). (optional)
:param string endpoint_override: Always use this endpoint URL for requests
for this client. (optional)
:param auth: An auth plugin to use instead of the session one. (optional)
@@ -248,7 +256,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
domain_name=None, project_id=None, project_name=None,
project_domain_id=None, project_domain_name=None,
trust_id=None, session=None, service_name=None,
- interface='admin', endpoint_override=None, auth=None,
+ interface='default', endpoint_override=None, auth=None,
user_agent=USER_AGENT, connect_retries=None, **kwargs):
# set baseline defaults
self.user_id = None
@@ -372,12 +380,21 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
self.session = session
self.domain = ''
- # NOTE(jamielennox): unfortunately we can't just use **kwargs here as
- # it would incompatibly limit the kwargs that can be passed to __init__
- # try and keep this list in sync with adapter.Adapter.__init__
version = (
_discover.normalize_version_number(self.version) if self.version
else None)
+
+ # NOTE(frickler): If we know we have v3, use the public interface as
+ # default, otherwise keep the historic default of admin
+ if interface == 'default':
+ if version == (3, 0):
+ interface = 'public'
+ else:
+ interface = 'admin'
+
+ # NOTE(jamielennox): unfortunately we can't just use **kwargs here as
+ # it would incompatibly limit the kwargs that can be passed to __init__
+ # try and keep this list in sync with adapter.Adapter.__init__
self._adapter = _KeystoneAdapter(session,
service_type='identity',
service_name=service_name,
diff --git a/keystoneclient/tests/unit/test_ec2utils.py b/keystoneclient/tests/unit/test_ec2utils.py
index 1d8809b..12cf575 100644
--- a/keystoneclient/tests/unit/test_ec2utils.py
+++ b/keystoneclient/tests/unit/test_ec2utils.py
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from __future__ import unicode_literals
-
import testtools
from keystoneclient.contrib.ec2 import utils
diff --git a/keystoneclient/tests/unit/test_session.py b/keystoneclient/tests/unit/test_session.py
index 14cfe31..f201a0b 100644
--- a/keystoneclient/tests/unit/test_session.py
+++ b/keystoneclient/tests/unit/test_session.py
@@ -243,7 +243,7 @@ class SessionTests(utils.TestCase):
session = client_session.Session(verify=False)
body = 'RESP'
- data = u'αβγδ'
+ data = 'αβγδ'
self.stub_url('POST', text=body)
session.post(self.TEST_URL, data=data)
diff --git a/keystoneclient/tests/unit/test_utils.py b/keystoneclient/tests/unit/test_utils.py
index 0144331..c1f6f8c 100644
--- a/keystoneclient/tests/unit/test_utils.py
+++ b/keystoneclient/tests/unit/test_utils.py
@@ -33,7 +33,7 @@ class FakeManager(object):
resources = {
'1234': {'name': 'entity_one'},
'8e8ec658-c7b0-4243-bdf8-6f7f2952c0d0': {'name': 'entity_two'},
- '\xe3\x82\xbdtest': {'name': u'\u30bdtest'},
+ '\xe3\x82\xbdtest': {'name': '\u30bdtest'},
'5678': {'name': '9876'}
}
diff --git a/keystoneclient/tests/unit/v2_0/client_fixtures.py b/keystoneclient/tests/unit/v2_0/client_fixtures.py
index 019b944..d3d8bca 100644
--- a/keystoneclient/tests/unit/v2_0/client_fixtures.py
+++ b/keystoneclient/tests/unit/v2_0/client_fixtures.py
@@ -9,8 +9,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
-from __future__ import unicode_literals
import uuid
from keystoneauth1 import fixture
diff --git a/keystoneclient/tests/unit/v3/client_fixtures.py b/keystoneclient/tests/unit/v3/client_fixtures.py
index 8e86208..e22e7da 100644
--- a/keystoneclient/tests/unit/v3/client_fixtures.py
+++ b/keystoneclient/tests/unit/v3/client_fixtures.py
@@ -9,8 +9,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
-from __future__ import unicode_literals
import uuid
from keystoneauth1 import fixture
diff --git a/keystoneclient/tests/unit/v3/test_auth.py b/keystoneclient/tests/unit/v3/test_auth.py
index 9f87977..d3c44ad 100644
--- a/keystoneclient/tests/unit/v3/test_auth.py
+++ b/keystoneclient/tests/unit/v3/test_auth.py
@@ -232,7 +232,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
self.stub_url('GET', [fake_url], json=fake_resp,
- base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
+ base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
@@ -335,7 +335,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
self.stub_url('GET', [fake_url], json=fake_resp,
- base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
+ base_url=self.TEST_PUBLIC_IDENTITY_ENDPOINT)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
diff --git a/keystoneclient/tests/unit/v3/utils.py b/keystoneclient/tests/unit/v3/utils.py
index 22430fa..e7d8b8d 100644
--- a/keystoneclient/tests/unit/v3/utils.py
+++ b/keystoneclient/tests/unit/v3/utils.py
@@ -48,6 +48,7 @@ class UnauthenticatedTestCase(utils.TestCase):
class TestCase(UnauthenticatedTestCase):
TEST_ADMIN_IDENTITY_ENDPOINT = "http://127.0.0.1:35357/v3"
+ TEST_PUBLIC_IDENTITY_ENDPOINT = "http://127.0.0.1:5000/v3"
TEST_SERVICE_CATALOG = [{
"endpoints": [{
diff --git a/keystoneclient/v3/contrib/oauth1/access_tokens.py b/keystoneclient/v3/contrib/oauth1/access_tokens.py
index b32eaf3..a64c5dd 100644
--- a/keystoneclient/v3/contrib/oauth1/access_tokens.py
+++ b/keystoneclient/v3/contrib/oauth1/access_tokens.py
@@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import unicode_literals
-
from keystoneauth1 import plugin
from keystoneclient import base
diff --git a/keystoneclient/v3/contrib/oauth1/request_tokens.py b/keystoneclient/v3/contrib/oauth1/request_tokens.py
index 0efe2de..c892f8b 100644
--- a/keystoneclient/v3/contrib/oauth1/request_tokens.py
+++ b/keystoneclient/v3/contrib/oauth1/request_tokens.py
@@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import unicode_literals
-
from keystoneauth1 import plugin
from six.moves.urllib import parse as urlparse
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 537da26..33dcdff 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -1,6 +1,5 @@
appdirs==1.3.0
asn1crypto==0.23.0
-Babel==2.3.4
bandit==1.1.0
cffi==1.14.0
cliff==2.8.0
@@ -16,6 +15,7 @@ future==0.16.0
gitdb==0.6.4
GitPython==1.0.1
idna==2.6
+importlib_metadata==1.7.0
iso8601==0.1.11
jsonschema==2.6.0
keyring==5.5.1
@@ -39,6 +39,7 @@ oslo.log==3.36.0
oslo.serialization==2.18.0
oslo.utils==3.33.0
oslotest==3.2.0
+packaging==20.4
paramiko==2.0.0
pbr==2.0.0
pep257==0.7.0
diff --git a/releasenotes/notes/switch-default-interface-v3-dcd7167196ace531.yaml b/releasenotes/notes/switch-default-interface-v3-dcd7167196ace531.yaml
new file mode 100644
index 0000000..90709c0
--- /dev/null
+++ b/releasenotes/notes/switch-default-interface-v3-dcd7167196ace531.yaml
@@ -0,0 +1,7 @@
+---
+features:
+ - |
+ For sessions using the v3 Identity API, the default interface has been
+ switched from ``admin`` to ``public``. This allows deployments to get rid
+ of the admin endpoint, which functionally is no longer necessary with the
+ v3 API.
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
index dc65fbe..f2ae6a4 100644
--- a/releasenotes/source/conf.py
+++ b/releasenotes/source/conf.py
@@ -54,7 +54,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-copyright = u'2015, Keystone Developers'
+copyright = '2015, Keystone Developers'
# Release notes are version independent.
# The full version, including alpha/beta/rc tags.
@@ -189,8 +189,8 @@ htmlhelp_basename = 'KeystoneClientReleaseNotesdoc'
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'keystoneclientReleaseNotes.tex',
- u'keystoneclient Release Notes Documentation',
- u'Keystone Developers', 'manual'),
+ 'keystoneclient Release Notes Documentation',
+ 'Keystone Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -220,8 +220,8 @@ latex_documents = [
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'keystoneclientreleasenotes',
- u'keystoneclient Release Notes Documentation',
- [u'Keystone Developers'], 1)
+ 'keystoneclient Release Notes Documentation',
+ ['Keystone Developers'], 1)
]
# If true, show URL addresses after external links.
@@ -235,8 +235,8 @@ man_pages = [
# dir menu entry, description, category)
texinfo_documents = [
('index', 'keystoneclientReleaseNotes',
- u'keystoneclient Release Notes Documentation',
- u'Keystone Developers', 'keystoneclientReleaseNotes',
+ 'keystoneclient Release Notes Documentation',
+ 'Keystone Developers', 'keystoneclientReleaseNotes',
'Python bindings for the OpenStack Identity service.',
'Miscellaneous'),
]
diff --git a/requirements.txt b/requirements.txt
index 65e83de..d60afab 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -13,3 +13,5 @@ oslo.utils>=3.33.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0
+importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0
+packaging>=20.4 # BSD
diff --git a/setup.cfg b/setup.cfg
index 0210957..2651e4a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -43,16 +43,3 @@ autodoc_tree_excludes =
setup.py
keystoneclient/tests/
-[compile_catalog]
-directory = keystoneclient/locale
-domain = keystoneclient
-
-[update_catalog]
-domain = keystoneclient
-output_dir = keystoneclient/locale
-input_file = keystoneclient/locale/keystoneclient.pot
-
-[extract_messages]
-keywords = _ gettext ngettext l_ lazy_gettext
-mapping_file = babel.cfg
-output_file = keystoneclient/locale/keystoneclient.pot