+CONF = {}
+
+
+def get_param(key, default=''):
+
+ # we have to defer this to runtime so that we can mock os.environ.get in unittests
+ conf_file = os.environ.get('CONF_FILE', '/etc/yardstick/yardstick.yaml')
+
+ # don't re-parse yaml for each lookup
+ if not CONF:
+ # 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:
+ if not default:
+ raise
+ return default
+
+