From: Zack Cerza Date: Fri, 23 Aug 2013 16:39:02 +0000 (-0500) Subject: Add teuthology.config, the start of a better system X-Git-Tag: 1.1.0~1926^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8d2ef931c5883dd1a04e563ebb67b381af6f541;p=teuthology.git Add teuthology.config, the start of a better system --- diff --git a/teuthology/config.py b/teuthology/config.py new file mode 100644 index 000000000..04e2aa299 --- /dev/null +++ b/teuthology/config.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +import os +import yaml +import logging + +CONF_FILE = os.path.join(os.environ['HOME'], '.teuthology.yaml') + +log = logging.getLogger(__name__) + + +class _Config(object): + def __init__(self): + self.__conf = {} + if not os.path.exists(CONF_FILE): + log.debug("%s not found", CONF_FILE) + return + + with file(CONF_FILE) as f: + conf_obj = yaml.safe_load_all(f) + for item in conf_obj: + self.__conf.update(item) + + @property + def lock_server(self): + return self.__conf.get('lock_server') + + @property + def queue_host(self): + return self.__conf.get('queue_host') + + @property + def queue_port(self): + return self.__conf.get('queue_port') + + @property + def sentry_dsn(self): + return self.__conf.get('sentry_dsn') + +config = _Config()