Merge "Yardstick GUI & GUI deployment"
[yardstick.git] / yardstick / benchmark / scenarios / availability / operation / operation_general.py
index 8fd387e..af1ae74 100644 (file)
@@ -15,7 +15,8 @@ from yardstick.benchmark.scenarios.availability.operation.baseoperation \
 
 import yardstick.ssh as ssh
 from yardstick.benchmark.scenarios.availability.util \
-    import buildshellparams, execute_shell_command
+    import buildshellparams, execute_shell_command, \
+    read_stdout_item, build_shell_command
 
 LOG = logging.getLogger(__name__)
 
@@ -39,11 +40,7 @@ class GeneralOperaion(BaseOperation):
         self.operation_key = self._config['operation_key']
 
         if "action_parameter" in self._config:
-            actionParameter = self._config['action_parameter']
-            str = buildshellparams(
-                actionParameter, True if self.connection else False)
-            l = list(item for item in actionParameter.values())
-            self.action_param = str.format(*l)
+            self.actionParameter_config = self._config['action_parameter']
 
         if "rollback_parameter" in self._config:
             rollbackParameter = self._config['rollback_parameter']
@@ -61,6 +58,11 @@ class GeneralOperaion(BaseOperation):
 
     def run(self):
         if "action_parameter" in self._config:
+            self.action_param = \
+                build_shell_command(
+                    self.actionParameter_config,
+                    True if self.connection else False,
+                    self.intermediate_variables)
             if self.connection:
                 with open(self.action_script, "r") as stdin_file:
                     exit_status, stdout, stderr = self.connection.execute(
@@ -83,6 +85,12 @@ class GeneralOperaion(BaseOperation):
 
         if exit_status == 0:
             LOG.debug("success,the operation's output is: %s", stdout)
+            if "return_parameter" in self._config:
+                returnParameter = self._config['return_parameter']
+                for key, item in returnParameter.items():
+                    value = read_stdout_item(stdout, key)
+                    LOG.debug("intermediate variables %s: %s", item, value)
+                    self.intermediate_variables[item] = value
         else:
             LOG.error(
                 "the operation's error, stdout:%s, stderr:%s",