Standardize all configuration loading

There was a large config refactor many releases ago, but
we never standardized on the new pattern. This will also
help ensure that config is always loaded in the right order.

- Standardize how config is setup throughout designate.
- Removed unecessary import_opt.


Change-Id: I8913d2569f174208740a76c474c73316f6c1d89e
This commit is contained in:
Erik Olof Gunnar Andersson 2023-11-01 15:58:43 -07:00
parent 68fc28527a
commit cc0431ba62
108 changed files with 434 additions and 370 deletions

View File

@ -12,15 +12,18 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import pecan.deploy
import designate.conf
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
def factory(global_config, **local_conf):
if not cfg.CONF['service:api'].enable_api_admin:
if not CONF['service:api'].enable_api_admin:
def disabled_app(environ, start_response):
status = '404 Not Found'
start_response(status, [])

View File

@ -13,17 +13,20 @@
# 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 oslo_config import cfg
import pecan
import pecan.deploy
from designate.api.v2 import patches
import designate.conf
CONF = designate.conf.CONF
def setup_app(pecan_config):
config = dict(pecan_config)
config['app']['debug'] = cfg.CONF['service:api'].pecan_debug
config['app']['debug'] = CONF['service:api'].pecan_debug
pecan.configuration.set_config(config, overwrite=True)

View File

@ -12,13 +12,14 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
from stevedore import named
from designate.api.v2.controllers import errors
import designate.conf
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -29,7 +30,7 @@ class RootController:
"""
def __init__(self):
enabled_ext = cfg.CONF['service:api'].enabled_extensions_admin
enabled_ext = CONF['service:api'].enabled_extensions_admin
if len(enabled_ext) > 0:
self._mgr = named.NamedExtensionManager(
namespace='designate.api.admin.extensions',

View File

@ -15,15 +15,15 @@
# under the License.
from urllib import parse
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate import exceptions
from designate import objects
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class BaseView:
@ -141,12 +141,12 @@ class BaseView:
# parents)
# defined in etc/designate/designate.conf.sample
limit = cfg.CONF['service:api'].default_limit_admin
limit = CONF['service:api'].default_limit_admin
if 'limit' in params:
limit = params['limit']
if limit.lower() == 'max':
limit = cfg.CONF['service:api'].max_limit_admin
limit = CONF['service:api'].max_limit_admin
else:
try:
limit = int(limit)

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import flask
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_middleware import base
@ -23,6 +22,7 @@ from oslo_serialization import jsonutils
from oslo_utils import strutils
import webob.dec
import designate.conf
from designate import context
from designate import exceptions
from designate import notifications
@ -30,6 +30,7 @@ from designate import objects
from designate.objects.adapters import DesignateAdapter
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -39,7 +40,7 @@ def auth_pipeline_factory(loader, global_conf, **local_conf):
Code nabbed from cinder.
"""
pipeline = local_conf[cfg.CONF['service:api'].auth_strategy]
pipeline = local_conf[CONF['service:api'].auth_strategy]
pipeline = pipeline.split()
LOG.info('Getting auth pipeline: %s', pipeline[:-1])
filters = [loader.get_filter(n) for n in pipeline[:-1]]
@ -227,8 +228,8 @@ class MaintenanceMiddleware(base.Middleware):
LOG.info('Starting designate maintenance middleware')
self.enabled = cfg.CONF['service:api'].maintenance_mode
self.role = cfg.CONF['service:api'].maintenance_mode_role
self.enabled = CONF['service:api'].maintenance_mode
self.role = CONF['service:api'].maintenance_mode_role
def process_request(self, request):
# If maintaince mode is not enabled, pass the request on as soon as

View File

@ -13,14 +13,16 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
from paste import deploy
import designate.conf
from designate import exceptions
from designate import service
from designate import utils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -29,7 +31,7 @@ class Service(service.WSGIService):
super().__init__(
self.wsgi_application,
self.service_name,
cfg.CONF['service:api'].listen,
CONF['service:api'].listen,
)
def start(self):
@ -44,7 +46,7 @@ class Service(service.WSGIService):
@property
def wsgi_application(self):
api_paste_config = cfg.CONF['service:api'].api_paste_config
api_paste_config = CONF['service:api'].api_paste_config
config_paths = utils.find_config(api_paste_config)
if not config_paths:

View File

@ -13,16 +13,18 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import pecan.deploy
import designate.conf
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
def factory(global_config, **local_conf):
if not cfg.CONF['service:api'].enable_api_v2:
if not CONF['service:api'].enable_api_v2:
def disabled_app(environ, start_response):
status = '404 Not Found'
start_response(status, [])

View File

@ -13,17 +13,20 @@
# 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 oslo_config import cfg
import pecan
import pecan.deploy
from designate.api.v2 import patches
import designate.conf
CONF = designate.conf.CONF
def setup_app(pecan_config):
config = dict(pecan_config)
config['app']['debug'] = cfg.CONF['service:api'].pecan_debug
config['app']['debug'] = CONF['service:api'].pecan_debug
pecan.configuration.set_config(config, overwrite=True)

View File

@ -13,13 +13,13 @@
# 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 oslo_config import cfg
import pecan
from designate.api.v2.controllers import rest
import designate.conf
CONF = cfg.CONF
CONF = designate.conf.CONF
class LimitsController(rest.RestController):

View File

@ -13,16 +13,18 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import pecan
from designate.api.v2.controllers import rest
from designate.common import keystone
import designate.conf
from designate import exceptions
from designate.objects.adapters import DesignateAdapter
from designate.objects import QuotaList
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -59,7 +61,7 @@ class QuotasController(rest.RestController):
# on a best effort basis
# this will raise only if KeystoneV3 endpoint is not found at all,
# or the creds are passing but the project is not found
if cfg.CONF['service:api'].quotas_verify_project_id:
if CONF['service:api'].quotas_verify_project_id:
keystone.verify_project_id(context, project_id)
quotas = DesignateAdapter.parse('API_v2', body, QuotaList())

View File

@ -13,7 +13,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 oslo_config import cfg
from stevedore import named
from designate.api.v2.controllers import blacklists
@ -27,6 +26,10 @@ from designate.api.v2.controllers import service_status
from designate.api.v2.controllers import tlds
from designate.api.v2.controllers import tsigkeys
from designate.api.v2.controllers import zones
import designate.conf
CONF = designate.conf.CONF
class RootController:
@ -36,7 +39,7 @@ class RootController:
"""
def __init__(self):
enabled_ext = cfg.CONF['service:api'].enabled_extensions_v2
enabled_ext = CONF['service:api'].enabled_extensions_v2
if len(enabled_ext) > 0:
self._mgr = named.NamedExtensionManager(
namespace='designate.api.v2.extensions',

View File

@ -13,7 +13,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 oslo_config import cfg
from oslo_log import log as logging
import pecan
@ -22,14 +21,14 @@ from designate.api.v2.controllers.zones import nameservers
from designate.api.v2.controllers.zones import recordsets
from designate.api.v2.controllers.zones import sharedzones
from designate.api.v2.controllers.zones import tasks
import designate.conf
from designate import exceptions
from designate import objects
from designate.objects.adapters import DesignateAdapter
from designate import utils
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -14,11 +14,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import flask
from oslo_config import cfg
from designate.common import constants
import designate.conf
cfg.CONF.import_opt('enable_host_header', 'designate.api', group='service:api')
CONF = designate.conf.CONF
def _add_a_version(versions, version, api_url, status, timestamp):
@ -38,10 +39,10 @@ def factory(global_config, **local_conf):
@app.route('/', methods=['GET'])
def version_list():
if cfg.CONF['service:api'].enable_host_header:
if CONF['service:api'].enable_host_header:
url_root = flask.request.url_root
else:
url_root = cfg.CONF['service:api'].api_base_uri
url_root = CONF['service:api'].api_base_uri
api_url = url_root.rstrip('/') + '/v2'
versions = []

View File

@ -19,12 +19,13 @@ from paste import deploy
from designate.common import config
from designate.common import profiler
from designate import conf
import designate.conf
from designate import heartbeat_emitter
from designate import policy
from designate import rpc
CONF = conf.CONF
CONF = designate.conf.CONF
CONFIG_FILES = ['api-paste.ini', 'designate.conf']
@ -41,7 +42,7 @@ def init_application():
logging.register_options(cfg.CONF)
cfg.CONF([], project='designate', default_config_files=conf_files)
config.set_defaults()
logging.setup(cfg.CONF, 'designate')
logging.setup(CONF, 'designate')
policy.init()

View File

@ -15,14 +15,15 @@
# under the License.
import abc
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.context import DesignateContext
from designate.plugin import DriverPlugin
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF = designate.conf.CONF
class Backend(DriverPlugin):

View File

@ -16,18 +16,19 @@
import time
from eventlet import Timeout
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
import requests
from requests.adapters import HTTPAdapter
from designate.backend import base
import designate.conf
from designate import exceptions
from designate import utils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CFG_GROUP_NAME = 'backend:dynect'

View File

@ -14,16 +14,17 @@
# under the License.
from urllib import parse
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import strutils
import requests
from designate.backend.impl_infoblox import ibexceptions as exc
import designate.conf
CFG_GROUP_NAME = 'backend:infoblox'
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = log.getLogger(__name__)

View File

@ -13,15 +13,16 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import requests
from designate.backend import base
import designate.conf
from designate import exceptions
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF = designate.conf.CONF
class NS1Backend(base.Backend):

View File

@ -15,15 +15,16 @@ import ipaddress
import os.path
import urllib
from oslo_config import cfg
from oslo_log import log as logging
import requests
from designate.backend import base
import designate.conf
from designate import exceptions
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF = designate.conf.CONF
class PDNS4Backend(base.Backend):

View File

@ -13,15 +13,16 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from designate.common import profiler
import designate.conf
from designate.loggingutils import rpc_logging
from designate import rpc
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CENTRAL_API = None
@ -80,7 +81,7 @@ class CentralAPI:
LOGGING_BLACKLIST = ['update_service_status']
def __init__(self, topic=None):
self.topic = topic if topic else cfg.CONF['service:central'].topic
self.topic = topic if topic else CONF['service:central'].topic
target = messaging.Target(topic=self.topic,
version=self.RPC_API_VERSION)

View File

@ -24,7 +24,6 @@ import time
from dns import exception as dnsexception
from dns import zone as dnszone
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import timeutils
@ -33,6 +32,7 @@ from designate.common import constants
from designate.common.decorators import lock
from designate.common.decorators import notification
from designate.common.decorators import rpc
import designate.conf
from designate import coordination
from designate import dnsutils
from designate import exceptions
@ -48,6 +48,8 @@ from designate.storage import transaction_shallow_copy
from designate import utils
from designate.worker import rpcapi as worker_rpcapi
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -65,13 +67,13 @@ class Service(service.RPCService):
self._quota = None
super().__init__(
self.service_name, cfg.CONF['service:central'].topic,
threads=cfg.CONF['service:central'].threads,
self.service_name, CONF['service:central'].topic,
threads=CONF['service:central'].threads,
)
self.coordination = coordination.Coordination(
self.service_name, self.tg, grouping_enabled=False
)
self.network_api = network_api.get_network_api(cfg.CONF.network_api)
self.network_api = network_api.get_network_api(CONF.network_api)
@property
def scheduler(self):
@ -98,7 +100,7 @@ class Service(service.RPCService):
return 'central'
def start(self):
if (cfg.CONF['service:central'].managed_resource_tenant_id ==
if (CONF['service:central'].managed_resource_tenant_id ==
"00000000-0000-0000-0000-000000000000"):
LOG.warning("Managed Resource Tenant ID is not properly "
"configured")
@ -119,7 +121,7 @@ class Service(service.RPCService):
if zone_name is None:
raise exceptions.InvalidObject
if len(zone_name) > cfg.CONF['service:central'].max_zone_name_len:
if len(zone_name) > CONF['service:central'].max_zone_name_len:
raise exceptions.InvalidZoneName('Name too long')
# Break the zone name up into its component labels
@ -172,7 +174,7 @@ class Service(service.RPCService):
raise ValueError('Please supply a FQDN')
# Validate record name length
max_len = cfg.CONF['service:central'].max_recordset_name_len
max_len = CONF['service:central'].max_recordset_name_len
if len(recordset_name) > max_len:
raise exceptions.InvalidRecordSetName('Name too long')
@ -336,7 +338,7 @@ class Service(service.RPCService):
def _is_valid_ttl(self, context, ttl):
if ttl is None:
return
min_ttl = cfg.CONF['service:central'].min_ttl
min_ttl = CONF['service:central'].min_ttl
if min_ttl is not None and ttl < int(min_ttl):
try:
policy.check('use_low_ttl', context)
@ -705,11 +707,11 @@ class Service(service.RPCService):
maximum val: default_soa_refresh_min
minimum val: default_soa_refresh_max
"""
assert cfg.CONF.default_soa_refresh_min is not None
assert cfg.CONF.default_soa_refresh_max is not None
dispersion = (cfg.CONF.default_soa_refresh_max -
cfg.CONF.default_soa_refresh_min) * random.random()
refresh_time = cfg.CONF.default_soa_refresh_min + dispersion
assert CONF.default_soa_refresh_min is not None
assert CONF.default_soa_refresh_max is not None
dispersion = (CONF.default_soa_refresh_max -
CONF.default_soa_refresh_min) * random.random()
refresh_time = CONF.default_soa_refresh_min + dispersion
return int(refresh_time)
def _get_pool_ns_records(self, context, pool_id):
@ -901,7 +903,7 @@ class Service(service.RPCService):
def get_zone_ns_records(self, context, zone_id=None, criterion=None):
if zone_id is None:
policy.check('get_zone_ns_records', context)
pool_id = cfg.CONF['service:central'].default_pool_id
pool_id = CONF['service:central'].default_pool_id
else:
zone = self.storage.get_zone(context, zone_id)
@ -1988,8 +1990,8 @@ class Service(service.RPCService):
zone_values = {
'type': 'PRIMARY',
'name': zone_name,
'email': cfg.CONF['service:central'].managed_resource_email,
'tenant_id': cfg.CONF['service:central'].managed_resource_tenant_id
'email': CONF['service:central'].managed_resource_email,
'tenant_id': CONF['service:central'].managed_resource_tenant_id
}
try:
zone = self.create_zone(

View File

@ -15,7 +15,6 @@
# under the License.
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
@ -28,8 +27,7 @@ from designate import version
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.api', group='service:api')
cfg.CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')
CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')
def main():

View File

@ -27,7 +27,6 @@ from designate import version
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.central', group='service:central')
def main():

View File

@ -27,7 +27,6 @@ from designate import version
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.mdns', group='service:mdns')
def main():

View File

@ -25,9 +25,9 @@ from designate import service
from designate import utils
from designate import version
LOG = logging.getLogger(__name__)
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.producer', group='service:producer')
LOG = logging.getLogger(__name__)
def main():

View File

@ -27,7 +27,6 @@ from designate import version
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.sink', group='service:sink')
def main():

View File

@ -25,9 +25,9 @@ from designate import utils
from designate import version
from designate.worker import service as worker_service
LOG = logging.getLogger(__name__)
CONF = designate.conf.CONF
CONF.import_opt('workers', 'designate.worker', group='service:worker')
LOG = logging.getLogger(__name__)
def main():

View File

@ -10,17 +10,16 @@
# 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 keystoneauth1 import exceptions as kse
from keystoneauth1 import loading as ksa_loading
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate import exceptions
from designate.i18n import _
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -19,12 +19,12 @@ import sys
from alembic import command as alembic_command
from alembic.config import Config
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.manage import base
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -13,8 +13,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 oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
import stevedore.exception
@ -22,6 +20,7 @@ import yaml
from designate.backend import base as backend_base
from designate.central import rpcapi as central_rpcapi
import designate.conf
from designate import exceptions
from designate.manage import base
from designate import objects
@ -30,8 +29,9 @@ from designate import policy
from designate import rpc
from designate import utils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class PoolCommands(base.Commands):
@ -44,7 +44,7 @@ class PoolCommands(base.Commands):
def _setup(self, dry_run=False, skip_verify_drivers=False):
self.dry_run = dry_run
self.skip_verify_drivers = skip_verify_drivers
rpc.init(cfg.CONF)
rpc.init(CONF)
self.central_api = central_rpcapi.CentralAPI()
@base.args('--file', help='The path to the file the yaml output should be '

View File

@ -15,17 +15,18 @@
import csv
import os
from oslo_config import cfg
from oslo_log import log as logging
from designate.central import rpcapi as central_rpcapi
from designate.common import constants
import designate.conf
from designate import exceptions
from designate.manage import base
from designate import objects
from designate import rpc
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -59,7 +60,7 @@ class TLDCommands(base.Commands):
super().__init__()
def _startup(self):
rpc.init(cfg.CONF)
rpc.init(CONF)
self.central_api = central_rpcapi.CentralAPI()
# The dictionary function __str__() does not list the fields in any

View File

@ -22,18 +22,15 @@ import dns.rdatatype
import dns.renderer
import dns.resolver
import dns.rrset
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate import exceptions
from designate.worker import rpcapi as worker_api
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('default_pool_id', 'designate.central',
group='service:central')
# 10 Bytes of RR metadata, 64 bytes of TSIG RR data, variable length TSIG Key
# name (restricted in designate to 160 chars), 1 byte for trailing dot.

View File

@ -13,9 +13,9 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.conf.mdns import DEFAULT_MDNS_PORT
from designate import dnsmiddleware
from designate import dnsutils
@ -24,8 +24,9 @@ from designate import service
from designate import storage
from designate import utils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class Service(service.Service):
@ -35,13 +36,13 @@ class Service(service.Service):
self._storage = None
super().__init__(
self.service_name, threads=cfg.CONF['service:mdns'].threads,
self.service_name, threads=CONF['service:mdns'].threads,
)
self.dns_service = service.DNSService(
self.dns_application, self.tg,
cfg.CONF['service:mdns'].listen,
cfg.CONF['service:mdns'].tcp_backlog,
cfg.CONF['service:mdns'].tcp_recv_timeout,
CONF['service:mdns'].listen,
CONF['service:mdns'].tcp_backlog,
CONF['service:mdns'].tcp_recv_timeout,
)
def start(self):

View File

@ -14,12 +14,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import eventlet.patcher
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate import exceptions
from designate.plugin import DriverPlugin
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
# NOTE(kiall): This is a workaround for bug #1424621, a broken reimplementation
# of eventlet's 0.17.0 monkey patching of dnspython.
@ -110,7 +112,7 @@ class NetworkAPI(DriverPlugin):
"""
if not config_section:
return None
cfg_group = cfg.CONF[config_section]
cfg_group = CONF[config_section]
return cfg_group.endpoints
def list_floatingips(self, context, region=None):

View File

@ -20,14 +20,15 @@ from keystoneauth1 import session
from keystoneauth1 import token_endpoint
import openstack
from openstack import exceptions as sdk_exceptions
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate import exceptions
from designate.network_api import base
from designate import version
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -16,15 +16,17 @@
# under the License.
import abc
from oslo_config import cfg
from oslo_log import log as logging
import re
from designate.central import rpcapi as central_rpcapi
import designate.conf
from designate.context import DesignateContext
from designate.plugin import ExtensionPlugin
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -88,13 +90,13 @@ class BaseAddressHandler(NotificationHandler):
def _get_formatv4(self):
return (
cfg.CONF[self.name].get('formatv4') or
CONF[self.name].get('formatv4') or
self.default_formatv4
)
def _get_formatv6(self):
return (
cfg.CONF[self.name].get('formatv6') or
CONF[self.name].get('formatv6') or
self.default_formatv6
)

View File

@ -9,11 +9,13 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.notification_handler import base
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -21,12 +23,12 @@ class FakeHandler(base.NotificationHandler):
__plugin_name__ = 'fake'
def get_exchange_topics(self):
exchange = cfg.CONF[self.name].control_exchange
topics = cfg.CONF[self.name].notification_topics
exchange = CONF[self.name].control_exchange
topics = CONF[self.name].notification_topics
return exchange, topics
def get_event_types(self):
return cfg.CONF[self.name].allowed_event_types
return CONF[self.name].allowed_event_types
def process_notification(self, context, event_type, payload):
LOG.info('%s: received notification - %s',

View File

@ -13,12 +13,13 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.notification_handler import base
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -27,9 +28,9 @@ class NeutronFloatingHandler(base.BaseAddressHandler):
__plugin_name__ = 'neutron_floatingip'
def get_exchange_topics(self):
exchange = cfg.CONF[self.name].control_exchange
exchange = CONF[self.name].control_exchange
topics = [topic for topic in cfg.CONF[self.name].notification_topics]
topics = [topic for topic in CONF[self.name].notification_topics]
return (exchange, topics)
@ -43,7 +44,7 @@ class NeutronFloatingHandler(base.BaseAddressHandler):
LOG.debug('%s received notification - %s',
self.get_canonical_name(), event_type)
zone_id = cfg.CONF[self.name].zone_id
zone_id = CONF[self.name].zone_id
if not zone_id:
LOG.error('NeutronFloatingHandler: zone_id is None, '

View File

@ -13,12 +13,13 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.notification_handler.base import BaseAddressHandler
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -27,9 +28,9 @@ class NovaFixedHandler(BaseAddressHandler):
__plugin_name__ = 'nova_fixed'
def get_exchange_topics(self):
exchange = cfg.CONF[self.name].control_exchange
exchange = CONF[self.name].control_exchange
topics = [topic for topic in cfg.CONF[self.name].notification_topics]
topics = [topic for topic in CONF[self.name].notification_topics]
return (exchange, topics)
@ -47,7 +48,7 @@ class NovaFixedHandler(BaseAddressHandler):
def process_notification(self, context, event_type, payload):
LOG.debug('NovaFixedHandler received notification - %s', event_type)
zone_id = cfg.CONF[self.name].zone_id
zone_id = CONF[self.name].zone_id
if not zone_id:
LOG.error('NovaFixedHandler: zone_id is None, ignore the event.')

View File

@ -17,7 +17,6 @@
# Copied: nova.notifications
import abc
from oslo_config import cfg
from oslo_log import log as logging
import designate.conf
@ -25,8 +24,9 @@ from designate import objects
from designate.plugin import DriverPlugin
from designate import rpc
LOG = logging.getLogger(__name__)
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
NOTIFICATION_PLUGIN = None
@ -42,8 +42,8 @@ def send_api_fault(context, url, status, exception):
def init_notification_plugin():
LOG.debug("Loading notification plugin: %s", cfg.CONF.notification_plugin)
cls = NotificationPlugin.get_driver(cfg.CONF.notification_plugin)
LOG.debug("Loading notification plugin: %s", CONF.notification_plugin)
cls = NotificationPlugin.get_driver(CONF.notification_plugin)
global NOTIFICATION_PLUGIN
NOTIFICATION_PLUGIN = cls()

View File

@ -11,14 +11,15 @@
# 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 oslo_config import cfg
from urllib import parse
import designate.conf
from designate import exceptions
from designate.objects.adapters import base
from designate.objects import base as ovoobj_base
CONF = cfg.CONF
CONF = designate.conf.CONF
class APIv2Adapter(base.DesignateAdapter):

View File

@ -15,10 +15,10 @@
from copy import deepcopy
from oslo_config import cfg
from oslo_log import log
from oslo_versionedobjects import exception as ovo_exc
import designate.conf
from designate import exceptions
from designate.objects import base
from designate.objects import fields
@ -27,10 +27,9 @@ from designate.objects.validation_error import ValidationErrorList
from designate import utils
CONF = designate.conf.CONF
LOG = log.getLogger(__name__)
cfg.CONF.import_opt('supported_record_type', 'designate')
@base.DesignateRegistry.register
class RecordSet(base.DesignateObject, base.DictObjectMixin,
@ -125,7 +124,7 @@ class RecordSet(base.DesignateObject, base.DictObjectMixin,
% {'type': self.type})
self._validate_fail(errors, err_msg)
if self.type not in cfg.CONF.supported_record_type:
if self.type not in CONF.supported_record_type:
err_msg = ("'%(type)s' is not a supported record type"
% {'type': self.type})
self._validate_fail(errors, err_msg)

View File

@ -15,13 +15,15 @@
# under the License.
import abc
from oslo_config import cfg
from oslo_log import log as logging
from stevedore import driver
from stevedore import enabled
import designate.conf
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class Plugin(metaclass=abc.ABCMeta):

View File

@ -19,10 +19,11 @@ from oslo_policy import opts
from oslo_policy import policy
from designate.common import policies
import designate.conf
from designate import exceptions
CONF = cfg.CONF
CONF = designate.conf.CONF
# Add the default policy opts
# TODO(gmann): Remove setting the default value of config policy_file
@ -45,7 +46,7 @@ def reset():
def set_rules(data, default_rule=None, overwrite=True):
default_rule = default_rule or cfg.CONF.policy_default_rule
default_rule = default_rule or CONF.policy_default_rule
if not _ENFORCER:
LOG.debug("Enforcer not present, recreating at rules stage.")
init()

View File

@ -13,19 +13,19 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from designate.central import rpcapi
import designate.conf
from designate import coordination
from designate import exceptions
from designate.producer import tasks
from designate import service
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
NS = 'designate.periodic_tasks'
@ -42,8 +42,8 @@ class Service(service.RPCService):
self._quota = None
super().__init__(
self.service_name, cfg.CONF['service:producer'].topic,
threads=cfg.CONF['service:producer'].threads,
self.service_name, CONF['service:producer'].topic,
threads=CONF['service:producer'].threads,
)
self.coordination = coordination.Coordination(

View File

@ -15,18 +15,19 @@
# under the License.
import datetime
from oslo_log import log as logging
from oslo_utils import timeutils
from designate.central import rpcapi
import designate.conf
from designate import context
from designate import plugin
from designate import rpc
from designate.worker import rpcapi as worker_rpcapi
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class PeriodicTask(plugin.ExtensionPlugin):

View File

@ -13,17 +13,18 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.quota import base
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
def get_quota():
quota_driver = cfg.CONF.quota_driver
quota_driver = CONF.quota_driver
LOG.debug("Loading quota driver: %s", quota_driver)

View File

@ -15,12 +15,14 @@
# under the License.
import abc
from oslo_config import cfg
import designate.conf
from designate import exceptions
from designate.plugin import DriverPlugin
CONF = designate.conf.CONF
class Quota(DriverPlugin, metaclass=abc.ABCMeta):
"""Base class for quota plugins"""
__plugin_ns__ = 'designate.quota'
@ -61,11 +63,11 @@ class Quota(DriverPlugin, metaclass=abc.ABCMeta):
def get_default_quotas(self, context):
return {
'zones': cfg.CONF.quota_zones,
'zone_recordsets': cfg.CONF.quota_zone_recordsets,
'zone_records': cfg.CONF.quota_zone_records,
'recordset_records': cfg.CONF.quota_recordset_records,
'api_export_size': cfg.CONF.quota_api_export_size,
'zones': CONF.quota_zones,
'zone_recordsets': CONF.quota_zone_recordsets,
'zone_records': CONF.quota_zone_records,
'recordset_records': CONF.quota_recordset_records,
'api_export_size': CONF.quota_api_export_size,
}
def get_quota(self, context, tenant_id, resource):

View File

@ -11,17 +11,17 @@
# 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 oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
from oslo_serialization import jsonutils
from oslo_utils import importutils
import designate.conf
import designate.context
import designate.exceptions
from designate import objects
profiler = importutils.try_import('osprofiler.profiler')
__all__ = [
@ -37,7 +37,7 @@ __all__ = [
'get_notifier',
]
CONF = cfg.CONF
CONF = designate.conf.CONF
NOTIFICATION_TRANSPORT = None
NOTIFIER = None
TRANSPORT = None

View File

@ -11,13 +11,14 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
from stevedore import named
import designate.conf
from designate import exceptions
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -31,7 +32,7 @@ class Scheduler:
"""The list of filters enabled on this scheduler"""
def __init__(self, storage):
enabled_filters = cfg.CONF['service:central'].scheduler_filters
enabled_filters = CONF['service:central'].scheduler_filters
self.filters = list()
self.storage = storage

View File

@ -11,12 +11,14 @@
# 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 oslo_config import cfg
import designate.conf
from designate import objects
from designate.scheduler.filters import base
CONF = designate.conf.CONF
class DefaultPoolFilter(base.Filter):
"""This filter will always return the default pool specified in the
designate config file
@ -36,5 +38,5 @@ class DefaultPoolFilter(base.Filter):
def filter(self, context, pools, zone):
pools = objects.PoolList()
pools.append(
objects.Pool(id=cfg.CONF['service:central'].default_pool_id))
objects.Pool(id=CONF['service:central'].default_pool_id))
return pools

View File

@ -11,17 +11,12 @@
# 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 oslo_config import cfg
import designate.conf
from designate import objects
from designate.scheduler.filters import base
cfg.CONF.register_opts([
cfg.StrOpt('default_pool_id',
default='794ccc2c-d751-44fe-b57f-8894c9f5c842',
help="The name of the default pool"),
], group='service:central')
CONF = designate.conf.CONF
class FallbackFilter(base.Filter):
@ -43,6 +38,6 @@ class FallbackFilter(base.Filter):
if not pools:
pools = objects.PoolList()
pools.append(
objects.Pool(id=cfg.CONF['service:central'].default_pool_id)
objects.Pool(id=CONF['service:central'].default_pool_id)
)
return pools

View File

@ -11,17 +11,12 @@
# 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 oslo_config import cfg
import designate.conf
from designate import objects
from designate.scheduler.filters import base
cfg.CONF.register_opts([
cfg.StrOpt('default_pool_id',
default='794ccc2c-d751-44fe-b57f-8894c9f5c842',
help="The name of the default pool"),
], group='service:central')
CONF = designate.conf.CONF
class InDoubtDefaultPoolFilter(base.Filter):
@ -46,7 +41,7 @@ class InDoubtDefaultPoolFilter(base.Filter):
def filter(self, context, pools, zone):
if len(pools) > 1:
default_pool_id = cfg.CONF['service:central'].default_pool_id
default_pool_id = CONF['service:central'].default_pool_id
try:
default_pool = self.storage.get_pool(context, default_pool_id)
except Exception:

View File

@ -14,22 +14,23 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
import designate.conf
from designate import notification_handler
from designate import rpc
from designate import service
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
class Service(service.Service):
def __init__(self):
super().__init__(
self.service_name, threads=cfg.CONF['service:sink'].threads
self.service_name, threads=CONF['service:sink'].threads
)
# Initialize extensions
@ -45,8 +46,9 @@ class Service(service.Service):
def _init_extensions():
"""Loads and prepares all enabled extensions"""
enabled_notification_handlers = cfg.CONF[
'service:sink'].enabled_notification_handlers
enabled_notification_handlers = (
CONF['service:sink'].enabled_notification_handlers
)
notification_handlers = notification_handler.get_notification_handlers(
enabled_notification_handlers)
@ -75,7 +77,7 @@ class Service(service.Service):
if targets:
self._server = rpc.get_notification_listener(
targets, [self],
pool=cfg.CONF['service:sink'].listener_pool_name
pool=CONF['service:sink'].listener_pool_name
)
self._server.start()

View File

@ -27,13 +27,16 @@ from oslo_utils import importutils
from osprofiler import opts as profiler
from sqlalchemy import inspect
import designate.conf
osprofiler_sqlalchemy = importutils.try_import('osprofiler.sqlalchemy')
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
try:
CONF.import_group("profiler", "designate.service")
CONF.import_group('profiler', 'designate.service')
except cfg.NoSuchGroupError:
pass
@ -45,7 +48,7 @@ _MAIN_CONTEXT_MANAGER = None
def initialize():
"""Initialize the module."""
connection = cfg.CONF['storage:sqlalchemy'].connection
connection = CONF['storage:sqlalchemy'].connection
db_options.set_defaults(
CONF, connection=connection
)

View File

@ -21,10 +21,10 @@ Create Date: 2022-07-28 23:06:40.731452
"""
from alembic import op
from oslo_config import cfg
from oslo_utils import timeutils
import sqlalchemy as sa
import designate.conf
from designate.conf import central
from designate.storage.sqlalchemy.alembic import legacy_utils
from designate.storage.sqlalchemy.types import UUID
@ -37,7 +37,7 @@ depends_on = None
# Equivalent to legacy sqlalchemy-migrate revision 070_liberty
CONF = cfg.CONF
CONF = designate.conf.CONF
central.register_opts(CONF)
ACTIONS = ('CREATE', 'DELETE', 'UPDATE', 'NONE')

View File

@ -17,15 +17,15 @@ from sqlalchemy import (Table, MetaData, Column, String, Text, Integer,
SmallInteger, CHAR, DateTime, Enum, Boolean, Unicode,
UniqueConstraint, ForeignKeyConstraint)
from oslo_config import cfg
from oslo_db.sqlalchemy import types
from oslo_utils import timeutils
import designate.conf
from designate.storage.sqlalchemy.types import UUID
from designate import utils
CONF = cfg.CONF
CONF = designate.conf.CONF
RESOURCE_STATUSES = ['ACTIVE', 'PENDING', 'DELETED', 'ERROR']
RECORD_TYPES = ['A', 'AAAA', 'CNAME', 'MX', 'SRV', 'TXT', 'SPF', 'NS', 'PTR',

View File

@ -22,7 +22,6 @@ import time
from unittest import mock
import eventlet
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log import log as logging
from oslo_messaging import conffixture as messaging_fixture
@ -45,14 +44,6 @@ eventlet.monkey_patch(os=False)
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
CONF.import_opt('auth_strategy', 'designate.api',
group='service:api')
CONF.import_opt('connection', 'designate.storage.sqlalchemy',
group='storage:sqlalchemy')
CONF.import_opt('emitter_type', 'designate.heartbeat_emitter',
group="heartbeat_emitter")
CONF.import_opt('scheduler_filters', 'designate.scheduler',
group="service:central")
default_pool_id = CONF['service:central'].default_pool_id
_TRUE_VALUES = ('true', '1', 'yes', 'y')
@ -432,7 +423,7 @@ class TestCase(base.BaseTestCase):
group = kwargs.pop('group', None)
for k, v in kwargs.items():
cfg.CONF.set_override(k, v, group)
CONF.set_override(k, v, group)
def policy(self, rules, default_rule='allow', overwrite=True):
# Inject an allow and deny rule

View File

@ -28,11 +28,11 @@ import shutil
import tempfile
import fixtures
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
import tooz.coordination
import designate.conf
from designate.manage import database as db_commands
from designate import network_api
from designate.network_api import fake as fake_network_api
@ -44,6 +44,7 @@ import designate.utils
"""Test fixtures
"""
_TRUE_VALUES = ('True', 'true', '1', 'yes')
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -170,7 +171,7 @@ class DatabaseFixture(fixtures.Fixture):
class NetworkAPIFixture(fixtures.Fixture):
def setUp(self):
super().setUp()
self.api = network_api.get_network_api(cfg.CONF.network_api)
self.api = network_api.get_network_api(CONF.network_api)
self.fake = fake_network_api
self.addCleanup(self.fake.reset_floatingips)

View File

@ -13,12 +13,11 @@
# 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 oslo_config import cfg
import designate.conf
from designate.tests.test_api.test_admin import AdminApiTestCase
cfg.CONF.import_opt('enabled_extensions_admin', 'designate.api.admin',
group='service:api')
CONF = designate.conf.CONF
class AdminApiQuotasTest(AdminApiTestCase):
@ -46,8 +45,8 @@ class AdminApiQuotasTest(AdminApiTestCase):
max_zones = response.json['quota']['zones']
max_zone_records = response.json['quota']['zone_records']
self.assertEqual(cfg.CONF.quota_zones, max_zones)
self.assertEqual(cfg.CONF.quota_zone_records, max_zone_records)
self.assertEqual(CONF.quota_zones, max_zones)
self.assertEqual(CONF.quota_zone_records, max_zone_records)
def test_patch_quotas(self):
self.policy({'set_quotas': '@'})

View File

@ -13,13 +13,8 @@
# 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 oslo_config import cfg
from designate.tests.test_api.test_admin import AdminApiTestCase
cfg.CONF.import_opt('enabled_extensions_admin', 'designate.api.admin',
group='service:api')
class AdminApiReportsTest(AdminApiTestCase):
def setUp(self):

View File

@ -16,17 +16,20 @@
# under the License.
from unittest import mock
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging.notify import notifier
from designate.api import middleware
import designate.conf
from designate import context
from designate import exceptions
from designate import rpc
import designate.tests
CONF = designate.conf.CONF
class FakeRequest:
def __init__(self):
self.headers = {}
@ -289,7 +292,7 @@ class FaultMiddlewareTest(designate.tests.TestCase):
@mock.patch.object(notifier.Notifier, 'error')
def test_notify_of_fault(self, mock_notifier):
self.config(notify_api_faults=True)
rpc.init(cfg.CONF)
rpc.init(CONF)
app = middleware.FaultWrapperMiddleware({})
class RaisingRequest(FakeRequest):

View File

@ -14,7 +14,6 @@
import unittest
from dns import zone as dnszone
from oslo_config import cfg
from webtest import TestApp
from designate.api import admin as admin_api
@ -22,10 +21,6 @@ from designate.api import middleware
from designate.tests.test_api.test_v2 import ApiV2TestCase
cfg.CONF.import_opt('enabled_extensions_admin', 'designate.api.admin',
group='service:api')
class APIV2ZoneImportExportTest(ApiV2TestCase):
def setUp(self):
super().setUp()

View File

@ -13,11 +13,13 @@
# 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 oslo_config import cfg
import designate.conf
from designate.tests.test_api.test_v2 import ApiV2TestCase
CONF = designate.conf.CONF
class ApiV2LimitsTest(ApiV2TestCase):
def test_get_limits(self):
response = self.client.get('/limits/')
@ -41,14 +43,14 @@ class ApiV2LimitsTest(ApiV2TestCase):
absolutelimits = response.json
self.assertEqual(cfg.CONF.quota_zones, absolutelimits['max_zones'])
self.assertEqual(cfg.CONF.quota_zone_records,
self.assertEqual(CONF.quota_zones, absolutelimits['max_zones'])
self.assertEqual(CONF.quota_zone_records,
absolutelimits['max_zone_recordsets'])
self.assertEqual(cfg.CONF['service:central'].min_ttl,
self.assertEqual(CONF['service:central'].min_ttl,
absolutelimits['min_ttl'])
self.assertEqual(cfg.CONF['service:central'].max_zone_name_len,
self.assertEqual(CONF['service:central'].max_zone_name_len,
absolutelimits['max_zone_name_length'])
self.assertEqual(cfg.CONF['service:central'].max_recordset_name_len,
self.assertEqual(CONF['service:central'].max_recordset_name_len,
absolutelimits['max_recordset_name_length'])
self.assertEqual(cfg.CONF['service:api'].max_limit_v2,
self.assertEqual(CONF['service:api'].max_limit_v2,
absolutelimits['max_page_limit'])

View File

@ -12,11 +12,13 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
import designate.conf
from designate.tests.test_api.test_v2 import ApiV2TestCase
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -160,7 +162,7 @@ class ApiV2PoolsTest(ApiV2TestCase):
self.assertEqual(1, len(response.json['pools']))
# GET the default pool
pool_id = cfg.CONF['service:central'].default_pool_id
pool_id = CONF['service:central'].default_pool_id
default_pool = self.central_service.get_pool(self.admin_context,
pool_id)

View File

@ -16,16 +16,19 @@
from unittest import mock
from unittest.mock import patch
from oslo_config import cfg
import oslo_messaging as messaging
from designate.central import service as central_service
import designate.conf
from designate import exceptions
from designate import objects
from designate.tests.test_api.test_v2 import ApiV2TestCase
from designate.worker import rpcapi as worker_api
CONF = designate.conf.CONF
class ApiV2ZonesTest(ApiV2TestCase):
def setUp(self):
super().setUp()
@ -541,7 +544,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
self.assertIn('id', response.json)
self.assertIn('created_at', response.json)
self.assertEqual('PENDING', response.json['status'])
self.assertEqual(cfg.CONF['service:central'].managed_resource_email,
self.assertEqual(CONF['service:central'].managed_resource_email,
response.json['email'])
self.assertIsNone(response.json['updated_at'])
@ -571,7 +574,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
{'host': '192.0.2.2', 'port': 69}
])
)
zone.email = cfg.CONF['service:central'].managed_resource_email
zone.email = CONF['service:central'].managed_resource_email
# Create a zone
zone = self.central_service.create_zone(self.admin_context, zone)
@ -603,7 +606,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
def test_xfr_request(self):
# Create a zone
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
# Create a zone
@ -641,7 +644,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
def test_update_secondary_email_invalid_object(self):
# Create a zone
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
# Create a zone
zone = self.create_zone(**fixture)

View File

@ -13,7 +13,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 collections import namedtuple
from concurrent import futures
import copy
@ -24,7 +23,6 @@ import random
import unittest
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_db import exception as db_exception
from oslo_log import log as logging
@ -35,6 +33,7 @@ from oslo_versionedobjects import exception as ovo_exc
import testtools
from designate.common import constants
import designate.conf
from designate import exceptions
from designate import objects
from designate.storage import sql
@ -44,6 +43,8 @@ from designate.tests import fixtures
from designate import utils
from designate.worker import rpcapi as worker_api
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -942,7 +943,7 @@ class CentralServiceTest(designate.tests.TestCase):
def test_update_zone_master_for_secondary_zone(self):
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
fixture['masters'] = [{'host': '192.0.2.10', 'port': 53}]
# Create a zone
@ -1447,7 +1448,7 @@ class CentralServiceTest(designate.tests.TestCase):
def test_xfr_zone(self):
# Create a zone
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
# Create a zone
@ -1466,7 +1467,7 @@ class CentralServiceTest(designate.tests.TestCase):
def test_xfr_zone_same_serial(self):
# Create a zone
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
# Create a zone
@ -1484,7 +1485,7 @@ class CentralServiceTest(designate.tests.TestCase):
def test_xfr_zone_lower_serial(self):
# Create a zone
fixture = self.get_zone_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
fixture['serial'] = 10
@ -1573,8 +1574,8 @@ class CentralServiceTest(designate.tests.TestCase):
# Create the Object
recordset = objects.RecordSet(name='www.%s' % zone.name, type='A')
self.useFixture(cfg_fixture.Config(cfg.CONF))
cfg.CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
self.useFixture(cfg_fixture.Config(CONF))
CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
context = self.get_context(project_id='1', roles=['member', 'reader'])
self.share_zone(context=self.admin_context, zone_id=zone.id,
@ -3854,7 +3855,7 @@ class CentralServiceTest(designate.tests.TestCase):
self.assertEqual('foo', result.message)
def test_create_ptr_zone(self):
cfg.CONF.set_override(
CONF.set_override(
'managed_resource_tenant_id',
self.admin_context.project_id,
'service:central'
@ -3869,7 +3870,7 @@ class CentralServiceTest(designate.tests.TestCase):
self.assertEqual('example.org.', zones[0]['name'])
def test_create_duplicate_ptr_zone(self):
cfg.CONF.set_override(
CONF.set_override(
'managed_resource_tenant_id',
self.admin_context.project_id,
'service:central'
@ -4035,8 +4036,8 @@ class CentralServiceTest(designate.tests.TestCase):
def test_share_zone_new_policy_defaults(self):
# Configure designate for enforcing the new policy defaults
self.useFixture(cfg_fixture.Config(cfg.CONF))
cfg.CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
self.useFixture(cfg_fixture.Config(CONF))
CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
context = self.get_context(project_id='1', roles=['member', 'reader'])
# Create a Shared Zone
@ -4077,8 +4078,8 @@ class CentralServiceTest(designate.tests.TestCase):
def test_unshare_zone_new_policy_defaults(self):
# Configure designate for enforcing the new policy defaults
self.useFixture(cfg_fixture.Config(cfg.CONF))
cfg.CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
self.useFixture(cfg_fixture.Config(CONF))
CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
context = self.get_context(project_id='1', roles=['member', 'reader'])
# Create a Shared Zone
@ -4178,8 +4179,8 @@ class CentralServiceTest(designate.tests.TestCase):
context=context, zone_id=zone.id, target_project_id="second_tenant"
)
self.useFixture(cfg_fixture.Config(cfg.CONF))
cfg.CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
self.useFixture(cfg_fixture.Config(CONF))
CONF.set_override('enforce_new_defaults', True, 'oslo_policy')
# Ensure we can retrieve both shared_zones
shared_zones = self.central_service.find_shared_zones(

View File

@ -14,15 +14,15 @@ from unittest import mock
import dns
import dns.query
import dns.tsigkeyring
from oslo_config import cfg
import designate.conf
from designate import dnsmiddleware
from designate import dnsutils
from designate.mdns import handler
from designate import storage
import designate.tests
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestSerializationMiddleware(designate.tests.TestCase):

View File

@ -16,15 +16,15 @@
import dns
import dns.query
import dns.tsigkeyring
from oslo_config import cfg
import designate.conf
from designate import dnsutils
from designate import exceptions
from designate import objects
from designate import storage
import designate.tests
CONF = cfg.CONF
CONF = designate.conf.CONF
SAMPLES = {
("cname.example.com.", "CNAME"): {
"ttl": 10800,

View File

@ -22,15 +22,16 @@ import dns.rdatatype
import dns.resolver
import dns.rrset
import dns.tsigkeyring
from oslo_config import cfg
import testtools
import designate.conf
from designate import context
from designate.mdns import handler
from designate import objects
import designate.tests
CONF = cfg.CONF
CONF = designate.conf.CONF
default_pool_id = CONF['service:central'].default_pool_id
ANSWER = [
@ -127,7 +128,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
attributes = attributes or []
masters = masters or [{"host": "192.0.2.1", "port": 53}]
fixture = self.get_zone_fixture("SECONDARY", values=values)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['email'] = CONF['service:central'].managed_resource_email
zone = objects.Zone(**fixture)
zone.attributes = objects.ZoneAttributeList().from_list(attributes)

View File

@ -15,14 +15,15 @@
# under the License.
from unittest import mock
from oslo_config import cfg
from oslo_log import log as logging
import testscenarios
import designate.conf
from designate import exceptions
from designate import quota
import designate.tests
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
load_tests = testscenarios.load_tests_apply_scenarios
@ -45,11 +46,11 @@ class QuotaTestCase(designate.tests.TestCase):
self.assertIsNotNone(quotas)
self.assertEqual({
'api_export_size': cfg.CONF.quota_api_export_size,
'zones': cfg.CONF.quota_zones,
'zone_recordsets': cfg.CONF.quota_zone_recordsets,
'zone_records': cfg.CONF.quota_zone_records,
'recordset_records': cfg.CONF.quota_recordset_records,
'api_export_size': CONF.quota_api_export_size,
'zones': CONF.quota_zones,
'zone_recordsets': CONF.quota_zone_recordsets,
'zone_records': CONF.quota_zone_records,
'recordset_records': CONF.quota_recordset_records,
}, quotas)
def test_limit_check_unknown(self):
@ -78,11 +79,11 @@ class QuotaTestCase(designate.tests.TestCase):
zone_records=0)
self.quota.limit_check(context, 'tenant_id',
zones=(cfg.CONF.quota_zones - 1))
zones=(CONF.quota_zones - 1))
self.quota.limit_check(
context,
'tenant_id',
zone_records=(cfg.CONF.quota_zone_records - 1))
zone_records=(CONF.quota_zone_records - 1))
def test_limit_check_at(self):
context = self.get_admin_context()
@ -90,13 +91,13 @@ class QuotaTestCase(designate.tests.TestCase):
self.assertRaisesRegex(
exceptions.OverQuota, 'Quota exceeded for zones\\.',
self.quota.limit_check,
context, 'tenant_id', zones=cfg.CONF.quota_zones + 1
context, 'tenant_id', zones=CONF.quota_zones + 1
)
self.assertRaisesRegex(
exceptions.OverQuota, 'Quota exceeded for zone_records\\.',
self.quota.limit_check,
context, 'tenant_id', zone_records=cfg.CONF.quota_zone_records + 1
context, 'tenant_id', zone_records=CONF.quota_zone_records + 1
)
def test_limit_check_unlimited(self):

View File

@ -17,10 +17,10 @@ import math
from sqlalchemy import text
from unittest import mock
from oslo_config import cfg
from oslo_log import log as logging
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
import designate.conf
from designate.conf.mdns import DEFAULT_MDNS_PORT
from designate import exceptions
from designate import objects
@ -29,6 +29,8 @@ from designate.storage import sql
from designate.tests import TestCase
from designate.utils import generate_uuid
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -651,7 +653,7 @@ class SqlalchemyStorageTest(TestCase):
# Zone Tests
def test_create_zone(self):
pool_id = cfg.CONF['service:central'].default_pool_id
pool_id = CONF['service:central'].default_pool_id
values = {
'tenant_id': self.admin_context.project_id,
'name': 'example.net.',

View File

@ -10,16 +10,16 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import webtest
from designate.api import versions
from designate.common import constants
import designate.conf
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestApiVersion(oslotest.base.BaseTestCase):

View File

@ -10,15 +10,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
from unittest import mock
from designate.api import wsgi
import designate.conf
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestApiWsgi(oslotest.base.BaseTestCase):

View File

@ -12,19 +12,19 @@
from unittest import mock
from oslo_config import cfg
import oslotest.base
from designate.central import service
from designate.common import profiler
import designate.conf
from designate import exceptions
from designate.objects import record
from designate.objects import zone
from designate import policy
from designate import rpc
CONF = cfg.CONF
CONF = designate.conf.CONF
class CentralTestCase(oslotest.base.BaseTestCase):

View File

@ -9,10 +9,8 @@
# 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 unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
@ -22,8 +20,10 @@ from designate.cmd import mdns
from designate.cmd import producer
from designate.cmd import sink
from designate.cmd import worker
import designate.conf
CONF = cfg.CONF
CONF = designate.conf.CONF
@mock.patch('designate.service.wait')

View File

@ -12,14 +12,15 @@
import sys
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
from designate.cmd import manage
import designate.conf
from designate.manage import base
CONF = cfg.CONF
CONF = designate.conf.CONF
class ManageTestCase(oslotest.base.BaseTestCase):

View File

@ -16,18 +16,19 @@
from unittest import mock
import dns
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_messaging import conffixture as messaging_fixture
import oslotest.base
import designate.conf
from designate import exceptions
from designate.mdns import handler
from designate import objects
from designate.tests import fixtures
from designate.worker import rpcapi as worker_rpcapi
CONF = cfg.CONF
CONF = designate.conf.CONF
class MdnsHandleTest(oslotest.base.BaseTestCase):

View File

@ -15,10 +15,10 @@
# under the License.
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import dnsmiddleware
from designate.mdns import handler
from designate.mdns import service
@ -27,7 +27,8 @@ from designate import storage
from designate.tests import fixtures
import designate.utils
CONF = cfg.CONF
CONF = designate.conf.CONF
class MdnsServiceTest(oslotest.base.BaseTestCase):

View File

@ -9,13 +9,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.mport threading
import designate.exceptions
from designate.network_api import base
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
CONF = cfg.CONF
import designate.conf
import designate.exceptions
from designate.network_api import base
CONF = designate.conf.CONF
SERVICE_CATALOG = [
{
@ -149,7 +151,7 @@ class NetworkEndpointsFromConfigTest(oslotest.base.BaseTestCase):
)
result = self.base.endpoints_from_config(
cfg.CONF['network_api:neutron'].endpoints,
CONF['network_api:neutron'].endpoints,
)
self.assertEqual(
@ -163,7 +165,7 @@ class NetworkEndpointsFromConfigTest(oslotest.base.BaseTestCase):
)
result = self.base.endpoints_from_config(
cfg.CONF['network_api:neutron'].endpoints,
CONF['network_api:neutron'].endpoints,
)
self.assertEqual(
@ -177,7 +179,7 @@ class NetworkEndpointsFromConfigTest(oslotest.base.BaseTestCase):
)
result = self.base.endpoints_from_config(
cfg.CONF['network_api:neutron'].endpoints,
CONF['network_api:neutron'].endpoints,
region='RegionFour',
)
@ -195,7 +197,7 @@ class NetworkEndpointsFromConfigTest(oslotest.base.BaseTestCase):
designate.exceptions.ConfigurationError,
'Endpoints are not correctly configured',
self.base.endpoints_from_config,
cfg.CONF['network_api:neutron'].endpoints,
CONF['network_api:neutron'].endpoints,
region='RegionFive',
)
@ -209,7 +211,7 @@ class NetworkEndpointsFromConfigTest(oslotest.base.BaseTestCase):
designate.exceptions.ConfigurationError,
'Endpoints are not correctly configured',
self.base.endpoints_from_config,
cfg.CONF['network_api:neutron'].endpoints,
CONF['network_api:neutron'].endpoints,
)

View File

@ -16,17 +16,18 @@
from unittest import mock
from openstack import exceptions as sdk_exceptions
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import context
from designate import exceptions
from designate.network_api import get_network_api
from designate.network_api import neutron
from designate import version
CONF = cfg.CONF
CONF = designate.conf.CONF
class NeutronNetworkAPITest(oslotest.base.BaseTestCase):

View File

@ -11,13 +11,14 @@
# under the License.mport threading
from unittest import mock
from oslo_config import cfg
import oslotest.base
import designate.conf
from designate.notification_handler import fake
from designate.tests import test_notification_handler
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestFakeHandler(oslotest.base.BaseTestCase,

View File

@ -15,17 +15,18 @@
# under the License.
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log import log as logging
import oslotest.base
import designate.conf
from designate import exceptions
from designate import objects
from designate.objects import adapters
from designate.objects.adapters.api_v2 import base
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -16,16 +16,18 @@
import itertools
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log import log as logging
import oslotest.base
import designate.conf
from designate import exceptions
from designate import objects
from designate.objects.adapters import DesignateAdapter
CONF = cfg.CONF
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -20,16 +20,17 @@ Unit-test Producer service
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import exceptions
from designate.producer import service
import designate.service
from designate.tests import fixtures
CONF = cfg.CONF
CONF = designate.conf.CONF
@mock.patch.object(service.rpcapi.CentralAPI, 'get_instance', mock.Mock())

View File

@ -27,6 +27,7 @@ from oslo_utils import timeutils
import oslotest.base
from designate.central import rpcapi as central_api
import designate.conf
from designate import context
from designate.producer import tasks
from designate import rpc
@ -44,7 +45,7 @@ DUMMY_TASK_OPTS = [
help='Default amount of results returned per page'),
]
CONF = cfg.CONF
CONF = designate.conf.CONF
CONF.register_group(DUMMY_TASK_GROUP)
CONF.register_opts(DUMMY_TASK_OPTS, group=DUMMY_TASK_GROUP)

View File

@ -11,14 +11,17 @@
# under the License.
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import designate.conf
from designate import exceptions
from designate import objects
from designate import scheduler
from designate import tests
CONF = designate.conf.CONF
DEFAULT_POOL_ID = BRONZE_POOL_ID = '67d71c2a-645c-4dde-a6b8-60a172c9ede8'
SILVER_POOL_ID = '5fabcd37-262c-4cf3-8625-7f419434b6df'
GOLD_POOL_ID = '24702e43-8a52-440f-ab74-19fc16048860'
@ -64,7 +67,7 @@ def build_test_pools():
class AttributeSchedulerPermutationsTest(tests.TestCase):
def setUp(self):
super().setUp()
self.CONF = self.useFixture(cfg_fixture.Config(cfg.CONF)).conf
self.CONF = self.useFixture(cfg_fixture.Config(CONF)).conf
self.context = self.get_context()
self.CONF.set_override(
@ -182,7 +185,7 @@ class AttributeSchedulerPermutationsTest(tests.TestCase):
class DefaultSchedulerPermutationsTest(tests.TestCase):
def setUp(self):
super().setUp()
self.CONF = self.useFixture(cfg_fixture.Config(cfg.CONF)).conf
self.CONF = self.useFixture(cfg_fixture.Config(CONF)).conf
self.context = self.get_context()
self.CONF.set_override(
@ -214,7 +217,7 @@ class DefaultSchedulerPermutationsTest(tests.TestCase):
class FallbackSchedulerPermutationsTest(tests.TestCase):
def setUp(self):
super().setUp()
self.CONF = self.useFixture(cfg_fixture.Config(cfg.CONF)).conf
self.CONF = self.useFixture(cfg_fixture.Config(CONF)).conf
self.context = self.get_context()
self.CONF.set_override(

View File

@ -9,19 +9,18 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.mport threading
from unittest import mock
from oslo_config import cfg
import oslotest.base
import designate.conf
from designate.notification_handler import fake
from designate.sink import service
from designate.tests import fixtures
from designate.tests import test_notification_handler
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestSinkNotification(oslotest.base.BaseTestCase,

View File

@ -9,13 +9,13 @@
# 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 oslo_config import cfg
import oslotest.base
import designate.conf
from designate.storage import sqlalchemy
CONF = cfg.CONF
CONF = designate.conf.CONF
class SqlalchemyTestCase(oslotest.base.BaseTestCase):

View File

@ -18,7 +18,6 @@ from unittest import mock
from unittest.mock import patch
import fixtures
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log import log as logging
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
@ -27,12 +26,15 @@ import testtools
import designate.central.service
from designate.central.service import Service
import designate.conf
from designate import exceptions
from designate import objects
from designate.storage import sqlalchemy
from designate.tests.fixtures import random_seed
from designate.tests import TestCase
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
@ -222,7 +224,7 @@ class NotMockedError(NotImplementedError):
class CentralBasic(TestCase):
def setUp(self):
super().setUp()
self.CONF = self.useFixture(cfg_fixture.Config(cfg.CONF)).conf
self.CONF = self.useFixture(cfg_fixture.Config(CONF)).conf
self.CONF([], project='designate')
mock_storage = mock.Mock(spec=sqlalchemy.SQLAlchemyStorage)
@ -279,7 +281,7 @@ class CentralBasic(TestCase):
class CentralServiceTestCase(CentralBasic):
def test_conf_fixture(self):
assert 'service:central' in cfg.CONF
assert 'service:central' in CONF
def test_init(self):
self.assertTrue(self.service.check_for_tlds)
@ -633,7 +635,7 @@ class CentralZoneTestCase(CentralBasic):
def test_is_valid_recordset_name_too_long(self):
zone = RoObject(name='example.org.')
cfg.CONF['service:central'].max_recordset_name_len = 255
CONF['service:central'].max_recordset_name_len = 255
rs_name = 'a' * 255 + '.org.'
with testtools.ExpectedException(exceptions.InvalidRecordSetName) as e:
self.service._is_valid_recordset_name(self.context, zone, rs_name)
@ -1831,8 +1833,8 @@ class CentralStatusTests(CentralBasic):
class CentralQuotaTest(unittest.TestCase):
def setUp(self):
self.CONF = cfg_fixture.Config(cfg.CONF)
cfg.CONF([], project='designate')
self.CONF = cfg_fixture.Config(CONF)
CONF([], project='designate')
self.CONF.config(quota_driver="noop")
self.context = mock.Mock()
self.zone = mock.Mock()

View File

@ -12,12 +12,13 @@
from unittest import mock
import dns.message
from oslo_config import cfg
import designate.conf
from designate import dnsmiddleware
import oslotest.base
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestDNSMiddleware(oslotest.base.BaseTestCase):

View File

@ -23,14 +23,15 @@ import dns.rcode
import dns.rdatatype
import dns.zone
import eventlet
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import dnsutils
from designate import exceptions
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestDNSUtils(oslotest.base.BaseTestCase):

View File

@ -14,16 +14,17 @@
import time
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_service import loopingcall
import oslotest.base
import designate.conf
from designate import heartbeat_emitter
from designate import objects
from designate.tests import fixtures
CONF = cfg.CONF
CONF = designate.conf.CONF
class HeartbeatEmitterTest(oslotest.base.BaseTestCase):
@ -105,7 +106,7 @@ class RpcEmitterTest(oslotest.base.BaseTestCase):
mock_service_status.assert_called_once_with(
service_name='svc',
hostname=cfg.CONF.host,
hostname=CONF.host,
status='UP',
stats={},
capabilities={},

View File

@ -13,19 +13,20 @@ import errno
import socket
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_service import service
import oslotest.base
from designate.common import profiler
import designate.conf
from designate.mdns import handler
from designate import policy
from designate import rpc
from designate import service as designate_service
from designate import utils
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestBaseService(oslotest.base.BaseTestCase):

View File

@ -14,15 +14,16 @@ from unittest import mock
import jinja2
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import exceptions
from designate.tests import fixtures
from designate import utils
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestUtils(oslotest.base.BaseTestCase):

View File

@ -13,12 +13,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.mport threading
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
from unittest import mock
from designate.central import rpcapi as central_rpcapi
import designate.conf
from designate import exceptions
from designate import objects
import designate.quota.base
@ -28,7 +28,7 @@ from designate.worker import rpcapi as worker_rpcapi
from designate.worker.tasks import base
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestTask(oslotest.base.BaseTestCase):

View File

@ -19,15 +19,16 @@ from unittest import mock
import dns
import dns.rdataclass
import dns.rdatatype
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate import dnsutils
from designate.tests.unit import RoObject
from designate.worker.tasks import zone as worker_zone
CONF = cfg.CONF
CONF = designate.conf.CONF
class WorkerNotifyTest(oslotest.base.BaseTestCase):

View File

@ -15,16 +15,16 @@
# under the License.mport threading
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import designate.conf
from designate import exceptions
from designate.tests import fixtures
from designate.tests import TestCase
from designate.worker import processing
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestProcessingExecutor(TestCase):

View File

@ -15,13 +15,13 @@
# under the License.mport threading
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslo_messaging as messaging
import oslotest.base
from designate import backend
from designate.central import rpcapi as central_rpcapi
import designate.conf
from designate import exceptions
from designate import objects
import designate.service
@ -31,7 +31,8 @@ from designate.tests import fixtures
from designate.worker import processing
from designate.worker import service
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestService(oslotest.base.BaseTestCase):

View File

@ -13,9 +13,10 @@ from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
import oslotest.base
import designate.conf
from designate.worker.tasks import base
CONF = cfg.CONF
CONF = designate.conf.CONF
class TestTaskConfig(oslotest.base.BaseTestCase):

Some files were not shown because too many files have changed in this diff Show More