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
This commit is contained in:
Brant Knudson 2015-01-06 09:44:31 -06:00
parent 86ac254fee
commit d34cffa65f
19 changed files with 51 additions and 39 deletions

View File

@ -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.

View File

@ -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

View File

@ -13,7 +13,7 @@
import abc
import logging
from oslo.config import cfg
from oslo_config import cfg
import six
from keystoneclient import _discover

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -13,7 +13,7 @@
import abc
import logging
from oslo.config import cfg
from oslo_config import cfg
import six
from keystoneclient import access

View File

@ -13,7 +13,7 @@
import abc
import logging
from oslo.config import cfg
from oslo_config import cfg
import six
from keystoneclient import access

View File

@ -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

View File

@ -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

View File

@ -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'.") % (

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'),
],
}

View File

@ -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

View File

@ -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