aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/availability/util.py
diff options
context:
space:
mode:
authortjuyinkanglin <14_ykl@tongji.edu.cn>2017-05-04 15:58:55 +0800
committerJing Lu <lvjing5@huawei.com>2017-05-04 12:59:21 +0000
commit1b267df54356da0cba66a33edaf68ee50ecee53d (patch)
tree6ee5b41fa486e747526bb4736f9578d32fcbb6ab /yardstick/benchmark/scenarios/availability/util.py
parent20f5b0a8580c0e8c659424bab434a0e30f3c88c1 (diff)
Bugfix: Local Openstack Operation in HA test frameworksdanube.2.RC1danube.2.0
JIRA: YARDSTICK-635 Change-Id: Ic27517714db9325e7a3b1ef623c49af61c36b2b5 Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn> (cherry picked from commit 2fb95fbb9380ea7ce92dcb32cd2f0789b9f91bdc)
Diffstat (limited to 'yardstick/benchmark/scenarios/availability/util.py')
-rw-r--r--yardstick/benchmark/scenarios/availability/util.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/yardstick/benchmark/scenarios/availability/util.py b/yardstick/benchmark/scenarios/availability/util.py
index 2addef8ef..eadbfa53b 100644
--- a/yardstick/benchmark/scenarios/availability/util.py
+++ b/yardstick/benchmark/scenarios/availability/util.py
@@ -6,14 +6,35 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import logging
+import subprocess
+import traceback
+LOG = logging.getLogger(__name__)
-def buildshellparams(param):
+
+def buildshellparams(param, remote=True):
i = 0
values = []
- result = '/bin/bash -s'
+ result = '/bin/bash -s' if remote else ''
for key in param.keys():
values.append(param[key])
result += " {%d}" % i
i = i + 1
return result
+
+
+def execute_shell_command(command):
+ """execute shell script with error handling"""
+ exitcode = 0
+ output = []
+ try:
+ LOG.debug("the command is: %s", command)
+ output = subprocess.check_output(command, shell=True)
+ except Exception:
+ exitcode = -1
+ output = traceback.format_exc()
+ LOG.error("exec command '%s' error:\n ", command)
+ LOG.error(traceback.format_exc())
+
+ return exitcode, output