Bugfix: no pod.yaml file error when run test case not in the root path
[yardstick.git] / yardstick / benchmark / contexts / node.py
index c3d6521..c4e603a 100644 (file)
@@ -8,10 +8,12 @@
 ##############################################################################
 
 import sys
+import os
 import yaml
 import logging
 
 from yardstick.benchmark.contexts.base import Context
+from yardstick.definitions import YARDSTICK_ROOT_PATH
 
 LOG = logging.getLogger(__name__)
 
@@ -33,7 +35,9 @@ class NodeContext(Context):
     def init(self, attrs):
         '''initializes itself from the supplied arguments'''
         self.name = attrs["name"]
-        self.file_path = attrs.get("file", "/etc/yardstick/nodes/pod.yaml")
+        self.file_path = attrs.get("file", "")
+        if not os.path.exists(self.file_path):
+            self.file_path = YARDSTICK_ROOT_PATH + self.file_path
 
         LOG.info("Parsing pod file: %s", self.file_path)