Fix config loading when running the watcher-api

This regression was caused when we upgrade the version of olso.
Unfortunately this issue wasn't picked up with the unit tests as
the cmds doesn't have unit tests yet.

Error message: "watcher-api fail with NoSuchOptError: no such option:debug"

This patchset implements unit tests for:

- 'watcher-api' command
- 'watcher-db-manage' command (and sub-command)
- 'watcher-applier' command

Change-Id: I2bea8aee28dec913ebc45f2824bf474f86652642
This commit is contained in:
Jean-Emile DARTOIS
2015-11-19 19:03:17 +01:00
committed by Vincent Françoise
parent 4d2d73aa98
commit 6a55914b05
14 changed files with 314 additions and 31 deletions

View File

@@ -49,8 +49,7 @@ CONF.register_opts(strategy_selector.WATCHER_GOALS_OPTS)
def get_pecan_config():
# Set up the pecan configuration
filename = api_config.__file__.replace('.pyc', '.py')
return pecan.configuration.conf_from_file(filename)
return pecan.configuration.conf_from_dict(api_config.PECAN_CONFIG)
def setup_app(config=None):

View File

@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals
from oslo_config import cfg
from watcher.api import hooks
@@ -42,5 +44,11 @@ app = {
# WSME Configurations
# See https://wsme.readthedocs.org/en/latest/integrate.html#configuration
wsme = {
'debug': cfg.CONF.debug,
'debug': cfg.CONF.get("debug") if "debug" in cfg.CONF else False,
}
PECAN_CONFIG = {
"server": server,
"app": app,
"wsme": wsme,
}