From d34cffa65fbc151af6dfd489d9d324547df1d1af Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Tue, 6 Jan 2015 09:44:31 -0600 Subject: [PATCH] Change oslo.config to oslo_config The oslo.config libraries are moving away from oslo-namespaced packages. Note that his requires oslo.config>=1.6.0 bp drop-namespace-packages Change-Id: Ic0d4053875da0628f2359c109f2779d12aadc3eb --- keystoneclient/auth/base.py | 10 +++++----- keystoneclient/auth/conf.py | 18 +++++++++--------- keystoneclient/auth/identity/base.py | 2 +- keystoneclient/auth/identity/generic/base.py | 2 +- .../auth/identity/generic/password.py | 2 +- keystoneclient/auth/identity/generic/token.py | 2 +- keystoneclient/auth/identity/v2.py | 2 +- keystoneclient/auth/identity/v3.py | 2 +- keystoneclient/auth/token_endpoint.py | 2 +- keystoneclient/contrib/auth/v3/saml2.py | 2 +- keystoneclient/hacking/checks.py | 4 ++-- keystoneclient/middleware/auth_token.py | 2 +- keystoneclient/session.py | 14 +++++++------- keystoneclient/tests/auth/test_cli.py | 2 +- keystoneclient/tests/auth/test_conf.py | 4 ++-- keystoneclient/tests/auth/utils.py | 2 +- keystoneclient/tests/client_fixtures.py | 12 ++++++++++++ keystoneclient/tests/test_session.py | 4 ++-- keystoneclient/tests/v3/test_auth_saml2.py | 2 +- 19 files changed, 51 insertions(+), 39 deletions(-) diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py index 9da90b74..3798e491 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneclient/auth/base.py @@ -174,10 +174,10 @@ class BaseAuthPlugin(object): :type parser: argparse.ArgumentParser """ - # NOTE(jamielennox): ideally oslo.config would be smart enough to + # NOTE(jamielennox): ideally oslo_config would be smart enough to # handle all the Opt manipulation that goes on in this file. However it # is currently not. Options are handled in as similar a way as - # possible to oslo.config such that when available we should be able to + # possible to oslo_config such that when available we should be able to # transition. for opt in cls.get_options(): @@ -220,10 +220,10 @@ class BaseAuthPlugin(object): @classmethod def register_conf_options(cls, conf, group): - """Register the oslo.config options that are needed for a plugin. + """Register the oslo_config options that are needed for a plugin. :param conf: A config object. - :type conf: oslo.config.cfg.ConfigOpts + :type conf: oslo_config.cfg.ConfigOpts :param string group: The group name that options should be read from. """ plugin_opts = cls.get_options() @@ -236,7 +236,7 @@ class BaseAuthPlugin(object): Convert the options already registered into a real plugin. :param conf: A config object. - :type conf: oslo.config.cfg.ConfigOpts + :type conf: oslo_config.cfg.ConfigOpts :param string group: The group name that options should be read from. :returns: An authentication Plugin. diff --git a/keystoneclient/auth/conf.py b/keystoneclient/auth/conf.py index fdd2aa45..b61c123c 100644 --- a/keystoneclient/auth/conf.py +++ b/keystoneclient/auth/conf.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg from keystoneclient.auth import base @@ -21,7 +21,7 @@ _AUTH_SECTION_OPT = cfg.StrOpt('auth_section', help=_section_help) def get_common_conf_options(): - """Get the oslo.config options common for all auth plugins. + """Get the oslo_config options common for all auth plugins. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. @@ -30,24 +30,24 @@ def get_common_conf_options(): :auth_plugin: The name of the pluign to load. :auth_section: The config file section to load options from. - :returns: A list of oslo.config options. + :returns: A list of oslo_config options. """ return [_AUTH_PLUGIN_OPT, _AUTH_SECTION_OPT] def get_plugin_options(name): - """Get the oslo.config options for a specific plugin. + """Get the oslo_config options for a specific plugin. This will be the list of config options that is registered and loaded by the specified plugin. - :returns: A list of oslo.config options. + :returns: A list of oslo_config options. """ return base.get_plugin_class(name).get_options() def register_conf_options(conf, group): - """Register the oslo.config options that are needed for a plugin. + """Register the oslo_config options that are needed for a plugin. This only registers the basic options shared by all plugins. Options that are specific to a plugin are loaded just before they are read. @@ -61,7 +61,7 @@ def register_conf_options(conf, group): taken from the same group as provided in the parameters. :param conf: config object to register with. - :type conf: oslo.config.cfg.ConfigOpts + :type conf: oslo_config.cfg.ConfigOpts :param string group: The ini group to register options in. """ conf.register_opt(_AUTH_SECTION_OPT, group=group) @@ -78,7 +78,7 @@ def register_conf_options(conf, group): def load_from_conf_options(conf, group, **kwargs): - """Load a plugin from an oslo.config CONF object. + """Load a plugin from an oslo_config CONF object. Each plugin will register their own required options and so there is no standard list and the plugin should be consulted. @@ -87,7 +87,7 @@ def load_from_conf_options(conf, group, **kwargs): before this function is called. :param conf: A conf object. - :type conf: oslo.config.cfg.ConfigOpts + :type conf: oslo_config.cfg.ConfigOpts :param string group: The group name that options should be read from. :returns: An authentication Plugin or None if a name is not provided diff --git a/keystoneclient/auth/identity/base.py b/keystoneclient/auth/identity/base.py index ad8adb00..d8cd2a6a 100644 --- a/keystoneclient/auth/identity/base.py +++ b/keystoneclient/auth/identity/base.py @@ -13,7 +13,7 @@ import abc import logging -from oslo.config import cfg +from oslo_config import cfg import six from keystoneclient import _discover diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneclient/auth/identity/generic/base.py index 7c5a80f7..6d1550e0 100644 --- a/keystoneclient/auth/identity/generic/base.py +++ b/keystoneclient/auth/identity/generic/base.py @@ -13,7 +13,7 @@ import abc import logging -from oslo.config import cfg +from oslo_config import cfg import six import six.moves.urllib.parse as urlparse diff --git a/keystoneclient/auth/identity/generic/password.py b/keystoneclient/auth/identity/generic/password.py index 724a3cd2..36f8f505 100644 --- a/keystoneclient/auth/identity/generic/password.py +++ b/keystoneclient/auth/identity/generic/password.py @@ -12,7 +12,7 @@ import logging -from oslo.config import cfg +from oslo_config import cfg from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity import v2 diff --git a/keystoneclient/auth/identity/generic/token.py b/keystoneclient/auth/identity/generic/token.py index 7d05ca46..36df821e 100644 --- a/keystoneclient/auth/identity/generic/token.py +++ b/keystoneclient/auth/identity/generic/token.py @@ -12,7 +12,7 @@ import logging -from oslo.config import cfg +from oslo_config import cfg from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity import v2 diff --git a/keystoneclient/auth/identity/v2.py b/keystoneclient/auth/identity/v2.py index bad0eac0..8eaa9c59 100644 --- a/keystoneclient/auth/identity/v2.py +++ b/keystoneclient/auth/identity/v2.py @@ -13,7 +13,7 @@ import abc import logging -from oslo.config import cfg +from oslo_config import cfg import six from keystoneclient import access diff --git a/keystoneclient/auth/identity/v3.py b/keystoneclient/auth/identity/v3.py index 0f44a269..16ecba18 100644 --- a/keystoneclient/auth/identity/v3.py +++ b/keystoneclient/auth/identity/v3.py @@ -13,7 +13,7 @@ import abc import logging -from oslo.config import cfg +from oslo_config import cfg import six from keystoneclient import access diff --git a/keystoneclient/auth/token_endpoint.py b/keystoneclient/auth/token_endpoint.py index 1a04b9d7..40550629 100644 --- a/keystoneclient/auth/token_endpoint.py +++ b/keystoneclient/auth/token_endpoint.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg from keystoneclient.auth import base diff --git a/keystoneclient/contrib/auth/v3/saml2.py b/keystoneclient/contrib/auth/v3/saml2.py index 69db21ba..f3bb1052 100644 --- a/keystoneclient/contrib/auth/v3/saml2.py +++ b/keystoneclient/contrib/auth/v3/saml2.py @@ -14,7 +14,7 @@ import datetime import uuid from lxml import etree -from oslo.config import cfg +from oslo_config import cfg from six.moves import urllib from keystoneclient import access diff --git a/keystoneclient/hacking/checks.py b/keystoneclient/hacking/checks.py index df2c9609..4ba30b7e 100644 --- a/keystoneclient/hacking/checks.py +++ b/keystoneclient/hacking/checks.py @@ -24,8 +24,8 @@ import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( - r"(((from)|(import))\s+oslo\.((serialization)|(utils)))|" - "(from\s+oslo\s+import\s+((serialization)|(utils)))") + r"(((from)|(import))\s+oslo\.((config)|(serialization)|(utils)))|" + "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)))") if re.match(oslo_namespace_imports, logical_line): msg = ("K333: '%s' must be used instead of '%s'.") % ( diff --git a/keystoneclient/middleware/auth_token.py b/keystoneclient/middleware/auth_token.py index f7a4add6..6bfc5504 100644 --- a/keystoneclient/middleware/auth_token.py +++ b/keystoneclient/middleware/auth_token.py @@ -157,7 +157,7 @@ import tempfile import time import netaddr -from oslo.config import cfg +from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import timeutils import requests diff --git a/keystoneclient/session.py b/keystoneclient/session.py index b3ae6333..ee489d45 100644 --- a/keystoneclient/session.py +++ b/keystoneclient/session.py @@ -17,7 +17,7 @@ import logging import os import time -from oslo.config import cfg +from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import importutils import requests @@ -645,7 +645,7 @@ class Session(object): @utils.positional.classmethod() def get_conf_options(cls, deprecated_opts=None): - """Get the oslo.config options that are needed for a + """Get the oslo_config options that are needed for a :py:class:`.Session`. These may be useful without being registered for config file generation @@ -669,7 +669,7 @@ class Session(object): old_opt = oslo.cfg.DeprecatedOpt('ca_file', 'old_group') deprecated_opts={'cafile': [old_opt]} - :returns: A list of oslo.config options. + :returns: A list of oslo_config options. """ if deprecated_opts is None: deprecated_opts = {} @@ -695,7 +695,7 @@ class Session(object): @utils.positional.classmethod() def register_conf_options(cls, conf, group, deprecated_opts=None): - """Register the oslo.config options that are needed for a session. + """Register the oslo_config options that are needed for a session. The options that are set are: :cafile: The certificate authority filename. @@ -704,7 +704,7 @@ class Session(object): :insecure: Whether to ignore SSL verification. :timeout: The max time to wait for HTTP connections. - :param oslo.config.Cfg conf: config object to register with. + :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the @@ -726,12 +726,12 @@ class Session(object): @classmethod def load_from_conf_options(cls, conf, group, **kwargs): - """Create a session object from an oslo.config object. + """Create a session object from an oslo_config object. The options must have been previously registered with register_conf_options. - :param oslo.config.Cfg conf: config object to register with. + :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param dict kwargs: Additional parameters to pass to session construction. diff --git a/keystoneclient/tests/auth/test_cli.py b/keystoneclient/tests/auth/test_cli.py index 33c28685..f2204ee7 100644 --- a/keystoneclient/tests/auth/test_cli.py +++ b/keystoneclient/tests/auth/test_cli.py @@ -15,7 +15,7 @@ import uuid import fixtures import mock -from oslo.config import cfg +from oslo_config import cfg from keystoneclient.auth import base from keystoneclient.auth import cli diff --git a/keystoneclient/tests/auth/test_conf.py b/keystoneclient/tests/auth/test_conf.py index 342333f3..c708acca 100644 --- a/keystoneclient/tests/auth/test_conf.py +++ b/keystoneclient/tests/auth/test_conf.py @@ -13,8 +13,8 @@ import uuid import mock -from oslo.config import cfg -from oslo.config import fixture as config +from oslo_config import cfg +from oslo_config import fixture as config import stevedore from keystoneclient.auth import base diff --git a/keystoneclient/tests/auth/utils.py b/keystoneclient/tests/auth/utils.py index cfca3799..31ed6e10 100644 --- a/keystoneclient/tests/auth/utils.py +++ b/keystoneclient/tests/auth/utils.py @@ -14,7 +14,7 @@ import functools import uuid import mock -from oslo.config import cfg +from oslo_config import cfg import six from keystoneclient import access diff --git a/keystoneclient/tests/client_fixtures.py b/keystoneclient/tests/client_fixtures.py index 09b4b7a2..82cebe27 100644 --- a/keystoneclient/tests/client_fixtures.py +++ b/keystoneclient/tests/client_fixtures.py @@ -559,6 +559,14 @@ class HackingCode(fixtures.Fixture): from oslo import serialization from oslo.serialization import jsonutils from oslo_serialization import jsonutils + + import oslo.config + import oslo_config + import oslo.config.cfg + import oslo_config.cfg + from oslo import config + from oslo.config import cfg + from oslo_config import cfg """, 'expected_errors': [ (1, 0, 'K333'), @@ -569,5 +577,9 @@ class HackingCode(fixtures.Fixture): (11, 0, 'K333'), (13, 0, 'K333'), (14, 0, 'K333'), + (17, 0, 'K333'), + (19, 0, 'K333'), + (21, 0, 'K333'), + (22, 0, 'K333'), ], } diff --git a/keystoneclient/tests/test_session.py b/keystoneclient/tests/test_session.py index 74258dbb..41cc5a47 100644 --- a/keystoneclient/tests/test_session.py +++ b/keystoneclient/tests/test_session.py @@ -15,8 +15,8 @@ import itertools import uuid import mock -from oslo.config import cfg -from oslo.config import fixture as config +from oslo_config import cfg +from oslo_config import fixture as config from oslo_serialization import jsonutils import requests import six diff --git a/keystoneclient/tests/v3/test_auth_saml2.py b/keystoneclient/tests/v3/test_auth_saml2.py index f9a07760..c2579c86 100644 --- a/keystoneclient/tests/v3/test_auth_saml2.py +++ b/keystoneclient/tests/v3/test_auth_saml2.py @@ -14,7 +14,7 @@ import os import uuid from lxml import etree -from oslo.config import fixture as config +from oslo_config import fixture as config import requests from six.moves import urllib