Implemented utils config module

Implemented utils config module

Partially Implements: blueprint centralise-config-opts

Change-Id: Ic09ecba60022b69ec4031608716e34209d3fe578
This commit is contained in:
Prudhvi Rao Shedimbi
2016-11-29 23:15:28 +00:00
parent 8e7ba3c44a
commit 04fdea2aa0
4 changed files with 43 additions and 13 deletions

View File

@@ -19,7 +19,6 @@
import re
from jsonschema import validators
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import strutils
from oslo_utils import timeutils
@@ -29,18 +28,9 @@ import six
from watcher._i18n import _LW
from watcher.common import exception
from watcher import conf
UTILS_OPTS = [
cfg.StrOpt('rootwrap_config',
default="/etc/watcher/rootwrap.conf",
help='Path to the rootwrap configuration file to use for '
'running commands as root.'),
cfg.StrOpt('tempdir',
help='Explicitly specify the temporary working directory.'),
]
CONF = cfg.CONF
CONF.register_opts(UTILS_OPTS)
CONF = conf.CONF
LOG = logging.getLogger(__name__)

View File

@@ -21,8 +21,10 @@ from oslo_config import cfg
from watcher.conf import api
from watcher.conf import service
from watcher.conf import utils
CONF = cfg.CONF
service.register_opts(CONF)
api.register_opts(CONF)
utils.register_opts(CONF)

View File

@@ -23,6 +23,7 @@ from watcher.common import clients
from watcher.common import exception
from watcher.common import paths
from watcher.conf import api as conf_api
from watcher.conf import utils
from watcher.db.sqlalchemy import models
from watcher.decision_engine.audit import continuous
from watcher.decision_engine import manager as decision_engine_manager
@@ -35,7 +36,8 @@ def list_opts():
('DEFAULT',
(conf_api.AUTH_OPTS +
exception.EXC_LOG_OPTS +
paths.PATH_OPTS)),
paths.PATH_OPTS +
utils.UTILS_OPTS)),
('api', conf_api.API_SERVICE_OPTS),
('database', models.SQL_OPTS),
('watcher_decision_engine',

36
watcher/conf/utils.py Normal file
View File

@@ -0,0 +1,36 @@
# -*- 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
UTILS_OPTS = [
cfg.StrOpt('rootwrap_config',
default="/etc/watcher/rootwrap.conf",
help='Path to the rootwrap configuration file to use for '
'running commands as root.'),
cfg.StrOpt('tempdir',
help='Explicitly specify the temporary working directory.'),
]
def register_opts(conf):
conf.register_opts(UTILS_OPTS)
def list_opts():
return [('DEFAULT', UTILS_OPTS)]