Avoid registration of config parameters
Configuration parameters should be registered by module which is user of kuryr-lib. Change-Id: I39dc27a8a9430327cdc75191f63c268354d07dab Closes-bug: #1615942
This commit is contained in:
parent
9560b68433
commit
6438b8f06d
|
@ -14,10 +14,10 @@ import os
|
|||
|
||||
import netaddr
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import excutils
|
||||
import pyroute2
|
||||
|
||||
from kuryr.lib import config
|
||||
from kuryr.lib import exceptions
|
||||
from kuryr.lib import utils
|
||||
|
||||
|
@ -152,7 +152,7 @@ def port_bind(endpoint_id, neutron_port, neutron_subnets,
|
|||
|
||||
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
|
||||
vif_details = utils.string_mappings(neutron_port.get(VIF_DETAILS_KEY))
|
||||
binding_exec_path = os.path.join(config.CONF.bindir, vif_type)
|
||||
binding_exec_path = os.path.join(cfg.CONF.bindir, vif_type)
|
||||
if not os.path.exists(binding_exec_path):
|
||||
cleanup_veth(ifname)
|
||||
raise exceptions.BindingNotSupportedFailure(
|
||||
|
@ -186,7 +186,7 @@ def port_unbind(endpoint_id, neutron_port):
|
|||
|
||||
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
|
||||
vif_details = utils.string_mappings(neutron_port.get(VIF_DETAILS_KEY))
|
||||
unbinding_exec_path = os.path.join(config.CONF.bindir, vif_type)
|
||||
unbinding_exec_path = os.path.join(cfg.CONF.bindir, vif_type)
|
||||
|
||||
port_id = neutron_port['id']
|
||||
ifname, _ = utils.get_veth_pair_names(port_id)
|
||||
|
|
|
@ -17,10 +17,8 @@ Routines for configuring Kuryr
|
|||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from kuryr.lib._i18n import _
|
||||
from kuryr.lib import version
|
||||
|
||||
|
||||
core_opts = [
|
||||
|
@ -82,18 +80,3 @@ binding_opts = [
|
|||
help=('The name prefix of the veth endpoint put inside the '
|
||||
'container.'))
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(core_opts)
|
||||
CONF.register_opts(neutron_opts, group='neutron_client')
|
||||
CONF.register_opts(keystone_opts, group='keystone_client')
|
||||
CONF.register_opts(binding_opts, 'binding')
|
||||
|
||||
# Setting oslo.log options for logging.
|
||||
log.register_options(CONF)
|
||||
|
||||
|
||||
def init(args, **kwargs):
|
||||
cfg.CONF(args=args, project='kuryr',
|
||||
version=version.version_info.release_string(), **kwargs)
|
||||
|
|
|
@ -10,15 +10,23 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib import constants as const
|
||||
from oslo_config import cfg
|
||||
from oslotest import base
|
||||
|
||||
from kuryr.lib import config
|
||||
from kuryr.lib import constants as const
|
||||
|
||||
|
||||
class TestCase(base.BaseTestCase):
|
||||
"""Test case base class for all unit tests."""
|
||||
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(config.core_opts)
|
||||
CONF.register_opts(config.neutron_opts, group='neutron_client')
|
||||
CONF.register_opts(config.keystone_opts, group='keystone_client')
|
||||
CONF.register_opts(config.binding_opts, 'binding')
|
||||
|
||||
@staticmethod
|
||||
def _get_fake_networks(neutron_network_id):
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib import config
|
||||
from oslo_config import cfg
|
||||
|
||||
from kuryr.tests.unit import base
|
||||
|
||||
|
||||
|
@ -19,13 +20,13 @@ class ConfigurationTest(base.TestCase):
|
|||
def test_defaults(self):
|
||||
|
||||
self.assertEqual('http://127.0.0.1:9696',
|
||||
config.CONF.neutron_client.neutron_uri)
|
||||
cfg.CONF.neutron_client.neutron_uri)
|
||||
|
||||
self.assertEqual('kuryr',
|
||||
config.CONF.neutron_client.default_subnetpool_v4)
|
||||
cfg.CONF.neutron_client.default_subnetpool_v4)
|
||||
|
||||
self.assertEqual('kuryr6',
|
||||
config.CONF.neutron_client.default_subnetpool_v6)
|
||||
cfg.CONF.neutron_client.default_subnetpool_v6)
|
||||
|
||||
self.assertEqual('http://127.0.0.1:35357/v2.0',
|
||||
config.CONF.keystone_client.auth_uri)
|
||||
cfg.CONF.keystone_client.auth_uri)
|
||||
|
|
Loading…
Reference in New Issue