From 4b34887dccbf44f6d4b63dc8f51691e2394c0345 Mon Sep 17 00:00:00 2001 From: Dimitri Mazmanov Date: Thu, 17 Mar 2016 15:45:23 +0100 Subject: [PATCH] Remove unnecessary db configuration. oslo.db has everything necessary for configuring db adapters, connections, drivers, etc. Removing useless base db class and respective configuration parameters. Change-Id: I47af59681cb60622ec990b1efd2d05af1d67a29e Depends-On: Change-Id: I7cdd01b3f1fe182ac76cacf060beb8e0a0017aa7 --- config-generator.conf | 1 - kingbird/common/manager.py | 8 +++---- kingbird/db/base.py | 46 -------------------------------------- setup.cfg | 1 - 4 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 kingbird/db/base.py diff --git a/config-generator.conf b/config-generator.conf index 4e81aa5..676b258 100644 --- a/config-generator.conf +++ b/config-generator.conf @@ -4,7 +4,6 @@ wrap_width = 79 namespace = kingbird.common.config namespace = kingbird.common.manager namespace = kingbird.common.baserpc -namespace = kingbird.db.base namespace = kingbird.engine.engine_config namespace = kingbird.engine.kingbird_lock namespace = kingbird.engine.quota_manager diff --git a/kingbird/common/manager.py b/kingbird/common/manager.py index ee848cf..cb90c2b 100755 --- a/kingbird/common/manager.py +++ b/kingbird/common/manager.py @@ -42,8 +42,6 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_service import periodic_task -from kingbird.db import base - CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -64,16 +62,16 @@ class PeriodicTasks(periodic_task.PeriodicTasks): super(PeriodicTasks, self).__init__(CONF) -class Manager(base.Base, PeriodicTasks): +class Manager(PeriodicTasks): - def __init__(self, host=None, db_driver=None, service_name='undefined'): + def __init__(self, host=None, service_name='undefined'): if not host: host = cfg.CONF.host_details.host self.host = host self.service_name = service_name # self.notifier = rpc.get_notifier(self.service_name, self.host) self.additional_endpoints = [] - super(Manager, self).__init__(db_driver) + super(Manager, self).__init__() def periodic_tasks(self, context, raise_on_error=False): """Tasks to be run at a periodic interval.""" diff --git a/kingbird/db/base.py b/kingbird/db/base.py deleted file mode 100644 index 3dd1141..0000000 --- a/kingbird/db/base.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# copy and modify from nova.db - -"""Base class for classes that need modular database access.""" - -from oslo_config import cfg -from oslo_utils import importutils - -db_driver_opt = [ - cfg.StrOpt('db_driver', - default='kingbird.db', - help='The driver to use for database access') -] -CONF = cfg.CONF - -db_option_group = cfg.OptGroup('db_options') -cfg.CONF.register_group(db_option_group) -cfg.CONF.register_opts(db_driver_opt, group=db_option_group) - - -class Base(object): - """DB driver is injected in the init method.""" - - def __init__(self, db_driver=None): - super(Base, self).__init__() - if not db_driver: - db_driver = CONF.db_options.db_driver - self.db = importutils.import_module(db_driver) - - -def list_opts(): - yield db_option_group.name, db_driver_opt diff --git a/setup.cfg b/setup.cfg index 34d18ca..3e0ee5c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,6 @@ oslo.config.opts = kingbird.engine.listener = kingbird.engine.listener:list_opts kingbird.engine.quota_manager = kingbird.engine.quota_manager:list_opts kingbird.common.api.api_config = kingbird.api.api_config:list_opts - kingbird.db.base= kingbird.db.base:list_opts kingbird.common.baserpc= kingbird.common.baserpc:list_opts kingbird.api.controllers.quota_manage= kingbird.api.controllers.quota_manage:list_opts