diff --git a/watcher/common/utils.py b/watcher/common/utils.py index 0ba98db76..44cb050d5 100644 --- a/watcher/common/utils.py +++ b/watcher/common/utils.py @@ -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__) diff --git a/watcher/conf/__init__.py b/watcher/conf/__init__.py index 818ec6abb..35583bf1c 100644 --- a/watcher/conf/__init__.py +++ b/watcher/conf/__init__.py @@ -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) diff --git a/watcher/conf/_opts.py b/watcher/conf/_opts.py index 6f996a59b..0e58ce2ba 100644 --- a/watcher/conf/_opts.py +++ b/watcher/conf/_opts.py @@ -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', diff --git a/watcher/conf/utils.py b/watcher/conf/utils.py new file mode 100644 index 000000000..7c2981ce8 --- /dev/null +++ b/watcher/conf/utils.py @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +# Copyright (c) 2016 Intel Corp +# +# Authors: Prudhvi Rao Shedimbi +# +# 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)]