Implemented exception config module

Implemented exception config module

Partially Implements: blueprint centralise-config-opts

Change-Id: Ic1b94e28a960a7306f15afbf69382edc15b5999e
This commit is contained in:
Prudhvi Rao Shedimbi
2016-11-29 22:21:53 +00:00
committed by David TARDIVEL
parent 5c79074e9c
commit 9e4bf718da
4 changed files with 39 additions and 10 deletions

View File

@@ -26,22 +26,16 @@ import functools
import sys
from keystoneclient import exceptions as keystone_exceptions
from oslo_config import cfg
from oslo_log import log as logging
import six
from watcher._i18n import _, _LE
from watcher import conf
LOG = logging.getLogger(__name__)
EXC_LOG_OPTS = [
cfg.BoolOpt('fatal_exception_format_errors',
default=False,
help='Make exception message format errors fatal.'),
]
CONF = cfg.CONF
CONF.register_opts(EXC_LOG_OPTS)
CONF = conf.CONF
def wrap_keystone_exception(func):

View File

@@ -20,6 +20,7 @@
from oslo_config import cfg
from watcher.conf import api
from watcher.conf import exception
from watcher.conf import paths
from watcher.conf import service
from watcher.conf import utils
@@ -30,3 +31,4 @@ service.register_opts(CONF)
api.register_opts(CONF)
utils.register_opts(CONF)
paths.register_opts(CONF)
exception.register_opts(CONF)

View File

@@ -20,8 +20,8 @@ from keystoneauth1 import loading as ka_loading
from watcher.applier import manager as applier_manager
from watcher.common import clients
from watcher.common import exception
from watcher.conf import api as conf_api
from watcher.conf import exception
from watcher.conf import paths
from watcher.conf import utils
from watcher.db.sqlalchemy import models

33
watcher/conf/exception.py Normal file
View File

@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 Intel Corp
#
# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.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.
from oslo_config import cfg
EXC_LOG_OPTS = [
cfg.BoolOpt('fatal_exception_format_errors',
default=False,
help='Make exception message format errors fatal.'),
]
def register_opts(conf):
conf.register_opts(EXC_LOG_OPTS)
def list_opts():
return [('DEFAULT', EXC_LOG_OPTS)]