Remove logger as input parameter of functions in openstack_utils
[functest.git] / utils / functest_utils.py
index 285f887..b51a1c8 100644 (file)
@@ -244,7 +244,8 @@ def execute_command(cmd, logger=None,
             print(msg_exec)
     p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
     while True:
-        line = p.stdout.readline().replace('\n', '')
+        output = p.stdout.readline()
+        line = output.replace('\n', '')
         if not line:
             break
         if logger:
@@ -309,13 +310,15 @@ def get_criteria_by_test(testname):
 #               YAML UTILS
 #
 # -----------------------------------------------------------
-def get_parameter_from_yaml(parameter):
+def get_parameter_from_yaml(parameter, file=None):
     """
     Returns the value of a given parameter in config_functest.yaml
     parameter must be given in string format with dots
     Example: general.openstack.image_name
     """
-    with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
+    if file is None:
+        file = os.environ["CONFIG_FUNCTEST_YAML"]
+    with open(file) as f:
         functest_yaml = yaml.safe_load(f)
     f.close()
     value = functest_yaml