Merge "Bugfix: yardstick always report 'PASS' to DB"
[yardstick.git] / yardstick / common / utils.py
index 92bb7b7..7a64b8c 100644 (file)
@@ -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')}