aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/utils.py
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-25 02:43:26 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-25 02:43:26 +0000
commitd29df23ae5057fe0ccded6f8d8f3e36a084a78b3 (patch)
treee3cf9338e708edbbcb66bf776ee529615989e982 /yardstick/common/utils.py
parenta513db6bb8f5887f975a1b0152818b682fb67095 (diff)
parentf49a1f22f8ba1bfa7a9942f7a9f084d2c9c81378 (diff)
Merge "yardstick env influxdb/grafana cmd support centos"
Diffstat (limited to 'yardstick/common/utils.py')
-rw-r--r--yardstick/common/utils.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 92bb7b7d3..7a64b8ca2 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -172,7 +172,15 @@ def write_file(path, data, mode='w'):
def parse_ini_file(path):
parser = configparser.ConfigParser()
- parser.read(path)
+
+ try:
+ files = parser.read(path)
+ except configparser.MissingSectionHeaderError:
+ logger.exception('invalid file type')
+ raise
+ else:
+ if not files:
+ raise RuntimeError('file not exist')
try:
default = {k: v for k, v in parser.items('DEFAULT')}