X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcommon%2Fconstants.py;h=32ed746dfaa149ccf774570eb59466cec293566a;hb=c8da044c3099eae481b720dcec306527dd705de4;hp=fe394fd4d0b126b9a5baf17ade35efe67c2c0495;hpb=255ae5b1e6e85f118ef42298bfbc8dce1ad1969f;p=yardstick.git diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index fe394fd4d..32ed746df 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -8,11 +8,16 @@ ############################################################################## from __future__ import absolute_import import os +import errno + from functools import reduce import pkg_resources -from yardstick.common.utils import parse_yaml +# this module must only import other modules that do +# not require loggers to be created, so this cannot +# include yardstick.common.utils +from yardstick.common.yaml_loader import yaml_load dirname = os.path.dirname abspath = os.path.abspath @@ -29,7 +34,19 @@ def get_param(key, default=''): # don't re-parse yaml for each lookup if not CONF: - CONF.update(parse_yaml(conf_file)) + # do not use yardstick.common.utils.parse_yaml + # since yardstick.common.utils creates a logger + # and so it cannot be imported before this code + try: + with open(conf_file) as f: + value = yaml_load(f) + except IOError: + pass + except OSError as e: + if e.errno != errno.EEXIST: + raise + else: + CONF.update(value) try: return reduce(lambda a, b: a[b], key.split('.'), CONF) except KeyError: @@ -59,6 +76,7 @@ if not SERVER_IP: # dir CONF_DIR = get_param('dir.conf', '/etc/yardstick') +IMAGE_DIR = get_param('dir.images', '/home/opnfv/images/') REPOS_DIR = get_param('dir.repos', '/home/opnfv/repos/yardstick') RELENG_DIR = get_param('dir.releng', '/home/opnfv/repos/releng') LOG_DIR = get_param('dir.log', '/tmp/yardstick/') @@ -109,7 +127,7 @@ GRAFANA_PORT = get_param('grafana.port', 3000) GRAFANA_USER = get_param('grafana.username', 'admin') GRAFANA_PASS = get_param('grafana.password', 'admin') GRAFANA_IMAGE = get_param('grafana.image', 'grafana/grafana') -GRAFANA_TAG = get_param('grafana.tag', '3.1.1') +GRAFANA_TAG = get_param('grafana.tag', '4.4.3') GRAFANA_MAPPING_PORT = 1948 # api