X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcommon%2Fconstants.py;h=153bd4bf4f5bf7d8084eb2bb0c3cf2b5916fff00;hb=700e7a8d92b373b42e0f406b9c58c6961c7f9e6f;hp=b416f42b9a79e4fc99d8bc3b0a161a6bcb86e656;hpb=6fd861c845a42d6a1aae8adc7facc28fba6cac58;p=yardstick.git diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index b416f42b9..153bd4bf4 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -7,12 +7,17 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## from __future__ import absolute_import + +import errno import os 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,17 @@ 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, OSError) as e: + if e.errno != errno.ENOENT: + raise + else: + CONF.update(value) try: return reduce(lambda a, b: a[b], key.split('.'), CONF) except KeyError: @@ -68,6 +83,7 @@ YARDSTICK_ROOT_PATH = dirname( TASK_LOG_DIR = get_param('dir.tasklog', '/var/log/yardstick/') CONF_SAMPLE_DIR = join(REPOS_DIR, 'etc/yardstick/') ANSIBLE_DIR = join(REPOS_DIR, 'ansible') +ANSIBLE_ROLES_PATH = join(REPOS_DIR, 'ansible/roles/') SAMPLE_CASE_DIR = join(REPOS_DIR, 'samples') TESTCASE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_cases/') TESTSUITE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_suites/') @@ -129,6 +145,10 @@ BASE_URL = 'http://localhost:5000' ENV_ACTION_API = BASE_URL + '/yardstick/env/action' ASYNC_TASK_API = BASE_URL + '/yardstick/asynctask' +# flags +IS_EXISTING = 'is_existing' +IS_PUBLIC = 'is_public' + # general TESTCASE_PRE = 'opnfv_yardstick_' TESTSUITE_PRE = 'opnfv_'