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:
parent
68fc28527a
commit
cc0431ba62
@ -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, [])
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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, [])
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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())
|
||||
|
@ -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',
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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 = []
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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'
|
||||
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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(
|
||||
|
@ -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():
|
||||
|
@ -27,7 +27,6 @@ from designate import version
|
||||
|
||||
|
||||
CONF = designate.conf.CONF
|
||||
CONF.import_opt('workers', 'designate.central', group='service:central')
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -27,7 +27,6 @@ from designate import version
|
||||
|
||||
|
||||
CONF = designate.conf.CONF
|
||||
CONF.import_opt('workers', 'designate.mdns', group='service:mdns')
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -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():
|
||||
|
@ -27,7 +27,6 @@ from designate import version
|
||||
|
||||
|
||||
CONF = designate.conf.CONF
|
||||
CONF.import_opt('workers', 'designate.sink', group='service:sink')
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -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():
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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 '
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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, '
|
||||
|
@ -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.')
|
||||
|
@ -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()
|
||||
|
@ -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):
|
||||
|