Removed duplicated function prepare_service()

The prepare_service() function is defined both in watcher/service.py
and in watcher/common/service.py.

These 2 needed to be merged into a single one
to avoid code duplication.

At the same time, the watcher/service.py only contains this function,
so I removed that file.

Change-Id: I0c935dfcd011bee9597315752dae8668221c53f9
Closes-Bug: #1525842
This commit is contained in:
Gábor Antal 2015-12-15 17:48:40 +01:00
parent 22dd6d42c3
commit f0b58f8c27
3 changed files with 6 additions and 33 deletions

View File

@ -26,7 +26,7 @@ from oslo_log import log as logging
from watcher._i18n import _
from watcher.api import app as api_app
from watcher import service
from watcher.common import service
LOG = logging.getLogger(__name__)

View File

@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import signal
import socket
@ -124,9 +125,10 @@ _DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'qpid.messaging=INFO',
'glanceclient=WARN', 'watcher.openstack.common=WARN']
def prepare_service(argv=[]):
log.register_options(cfg.CONF)
def prepare_service(argv=[], conf=cfg.CONF):
log.register_options(conf)
config.parse_args(argv)
cfg.set_defaults(_options.log_opts,
default_log_levels=_DEFAULT_LOG_LEVELS)
log.setup(cfg.CONF, 'python-watcher')
log.setup(conf, 'python-watcher')
conf.log_opt_values(LOG, logging.DEBUG)

View File

@ -1,29 +0,0 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# 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.
import logging
from oslo_config import cfg
from oslo_log import log
LOG = log.getLogger(__name__)
def prepare_service(args=None, conf=cfg.CONF):
log.register_options(conf)
log.setup(conf, 'watcher')
conf(args, project='python-watcher')
conf.log_opt_values(LOG, logging.DEBUG)