Merge "Change oslo.config to oslo_config"

This commit is contained in:
Jenkins
2015-02-10 02:14:56 +00:00
committed by Gerrit Code Review
19 changed files with 51 additions and 39 deletions

View File

@@ -217,10 +217,10 @@ class BaseAuthPlugin(object):
:type parser: argparse.ArgumentParser :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 # 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 # 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. # transition.
for opt in cls.get_options(): for opt in cls.get_options():
@@ -263,10 +263,10 @@ class BaseAuthPlugin(object):
@classmethod @classmethod
def register_conf_options(cls, conf, group): 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. :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. :param string group: The group name that options should be read from.
""" """
plugin_opts = cls.get_options() plugin_opts = cls.get_options()
@@ -279,7 +279,7 @@ class BaseAuthPlugin(object):
Convert the options already registered into a real plugin. Convert the options already registered into a real plugin.
:param conf: A config object. :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. :param string group: The group name that options should be read from.
:returns: An authentication Plugin. :returns: An authentication Plugin.

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from keystoneclient.auth import base from keystoneclient.auth import base
@@ -21,7 +21,7 @@ _AUTH_SECTION_OPT = cfg.StrOpt('auth_section', help=_section_help)
def get_common_conf_options(): 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 These may be useful without being registered for config file generation
or to manipulate the options before registering them yourself. 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_plugin: The name of the pluign to load.
:auth_section: The config file section to load options from. :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] return [_AUTH_PLUGIN_OPT, _AUTH_SECTION_OPT]
def get_plugin_options(name): 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 This will be the list of config options that is registered and loaded by
the specified plugin. 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() return base.get_plugin_class(name).get_options()
def register_conf_options(conf, group): 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 This only registers the basic options shared by all plugins. Options that
are specific to a plugin are loaded just before they are read. 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. taken from the same group as provided in the parameters.
:param conf: config object to register with. :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. :param string group: The ini group to register options in.
""" """
conf.register_opt(_AUTH_SECTION_OPT, group=group) 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): 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 Each plugin will register their own required options and so there is no
standard list and the plugin should be consulted. 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. before this function is called.
:param conf: A conf object. :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. :param string group: The group name that options should be read from.
:returns: An authentication Plugin or None if a name is not provided :returns: An authentication Plugin or None if a name is not provided

View File

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

View File

@@ -13,7 +13,7 @@
import abc import abc
import logging import logging
from oslo.config import cfg from oslo_config import cfg
import six import six
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse

View File

@@ -12,7 +12,7 @@
import logging import logging
from oslo.config import cfg from oslo_config import cfg
from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity.generic import base
from keystoneclient.auth.identity import v2 from keystoneclient.auth.identity import v2

View File

@@ -12,7 +12,7 @@
import logging import logging
from oslo.config import cfg from oslo_config import cfg
from keystoneclient.auth.identity.generic import base from keystoneclient.auth.identity.generic import base
from keystoneclient.auth.identity import v2 from keystoneclient.auth.identity import v2

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg from oslo_config import cfg
from keystoneclient.auth import base from keystoneclient.auth import base

View File

@@ -14,7 +14,7 @@ import datetime
import uuid import uuid
from lxml import etree from lxml import etree
from oslo.config import cfg from oslo_config import cfg
from six.moves import urllib from six.moves import urllib
from keystoneclient import access from keystoneclient import access

View File

@@ -24,8 +24,8 @@ import re
def check_oslo_namespace_imports(logical_line, blank_before, filename): def check_oslo_namespace_imports(logical_line, blank_before, filename):
oslo_namespace_imports = re.compile( oslo_namespace_imports = re.compile(
r"(((from)|(import))\s+oslo\.((serialization)|(utils)))|" r"(((from)|(import))\s+oslo\.((config)|(serialization)|(utils)))|"
"(from\s+oslo\s+import\s+((serialization)|(utils)))") "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)))")
if re.match(oslo_namespace_imports, logical_line): if re.match(oslo_namespace_imports, logical_line):
msg = ("K333: '%s' must be used instead of '%s'.") % ( msg = ("K333: '%s' must be used instead of '%s'.") % (

View File

@@ -157,7 +157,7 @@ import tempfile
import time import time
import netaddr import netaddr
from oslo.config import cfg from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import timeutils from oslo_utils import timeutils
import requests import requests

View File

@@ -18,7 +18,7 @@ import os
import socket import socket
import time import time
from oslo.config import cfg from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import importutils from oslo_utils import importutils
import requests import requests
@@ -667,7 +667,7 @@ class Session(object):
@utils.positional.classmethod() @utils.positional.classmethod()
def get_conf_options(cls, deprecated_opts=None): 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`. :py:class:`.Session`.
These may be useful without being registered for config file generation These may be useful without being registered for config file generation
@@ -691,7 +691,7 @@ class Session(object):
old_opt = oslo.cfg.DeprecatedOpt('ca_file', 'old_group') old_opt = oslo.cfg.DeprecatedOpt('ca_file', 'old_group')
deprecated_opts={'cafile': [old_opt]} deprecated_opts={'cafile': [old_opt]}
:returns: A list of oslo.config options. :returns: A list of oslo_config options.
""" """
if deprecated_opts is None: if deprecated_opts is None:
deprecated_opts = {} deprecated_opts = {}
@@ -717,7 +717,7 @@ class Session(object):
@utils.positional.classmethod() @utils.positional.classmethod()
def register_conf_options(cls, conf, group, deprecated_opts=None): 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: The options that are set are:
:cafile: The certificate authority filename. :cafile: The certificate authority filename.
@@ -726,7 +726,7 @@ class Session(object):
:insecure: Whether to ignore SSL verification. :insecure: Whether to ignore SSL verification.
:timeout: The max time to wait for HTTP connections. :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 string group: The ini group to register options in.
:param dict deprecated_opts: Deprecated options that should be included :param dict deprecated_opts: Deprecated options that should be included
in the definition of new options. This should be a dict from the in the definition of new options. This should be a dict from the
@@ -748,12 +748,12 @@ class Session(object):
@classmethod @classmethod
def load_from_conf_options(cls, conf, group, **kwargs): 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 The options must have been previously registered with
register_conf_options. 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 string group: The ini group to register options in.
:param dict kwargs: Additional parameters to pass to session :param dict kwargs: Additional parameters to pass to session
construction. construction.

View File

@@ -15,7 +15,7 @@ import uuid
import fixtures import fixtures
import mock import mock
from oslo.config import cfg from oslo_config import cfg
from keystoneclient.auth import base from keystoneclient.auth import base
from keystoneclient.auth import cli from keystoneclient.auth import cli

View File

@@ -13,8 +13,8 @@
import uuid import uuid
import mock import mock
from oslo.config import cfg from oslo_config import cfg
from oslo.config import fixture as config from oslo_config import fixture as config
import stevedore import stevedore
from keystoneclient.auth import base from keystoneclient.auth import base

View File

@@ -14,7 +14,7 @@ import functools
import uuid import uuid
import mock import mock
from oslo.config import cfg from oslo_config import cfg
import six import six
from keystoneclient import access from keystoneclient import access

View File

@@ -559,6 +559,14 @@ class HackingCode(fixtures.Fixture):
from oslo import serialization from oslo import serialization
from oslo.serialization import jsonutils from oslo.serialization import jsonutils
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': [ 'expected_errors': [
(1, 0, 'K333'), (1, 0, 'K333'),
@@ -569,5 +577,9 @@ class HackingCode(fixtures.Fixture):
(11, 0, 'K333'), (11, 0, 'K333'),
(13, 0, 'K333'), (13, 0, 'K333'),
(14, 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 uuid
import mock import mock
from oslo.config import cfg from oslo_config import cfg
from oslo.config import fixture as config from oslo_config import fixture as config
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import requests import requests
import six import six

View File

@@ -14,7 +14,7 @@ import os
import uuid import uuid
from lxml import etree from lxml import etree
from oslo.config import fixture as config from oslo_config import fixture as config
import requests import requests
from six.moves import urllib from six.moves import urllib