aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRyan.RCS <lihainong@huawei.com>2016-12-20 08:36:24 +0000
committerRyan.RCS <lihainong@huawei.com>2016-12-21 02:03:48 +0000
commitaad4b7d74f7bfd272fd7ab601a61e7f2c4d0e64c (patch)
tree44f917519246b1776576fb5d1af36e2667561649 /yardstick
parent367691281be05a5f2c76455465ff14078415e6c2 (diff)
subprocess.call para stdout=PIPE is risky
1.In 'def run' function of parser.py file, subprocess.call parameter stdout= subprocess.PIPE is risky, so I changed the function from 'call' to 'popen' 2.updated sample/tosca.ymal because the version of that file is old. JIRA: YARDSTICK-473 Change-Id: Ie242e77eed6fdc2849394a3f170e40a0dd2be632 Signed-off-by: Ryan.RCS <lihainong@huawei.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/scenarios/parser/parser.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yardstick/benchmark/scenarios/parser/parser.py b/yardstick/benchmark/scenarios/parser/parser.py
index 006258d05..bb16e7c89 100644
--- a/yardstick/benchmark/scenarios/parser/parser.py
+++ b/yardstick/benchmark/scenarios/parser/parser.py
@@ -58,10 +58,12 @@ class Parser(base.Scenario):
cmd1 = "%s %s %s" % (self.parser_script, yangfile, toscafile)
cmd2 = "chmod 777 %s" % (self.parser_script)
subprocess.call(cmd2, shell=True)
- output = subprocess.call(cmd1, shell=True, stdout=subprocess.PIPE)
+ p = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ p.communicate()
print "yangtotosca finished"
- result['yangtotosca'] = "success" if output == 0 else "fail"
+ result['yangtotosca'] = "success" if p.returncode == 0 else "fail"
def teardown(self):
''' for scenario teardown remove parser and pyang '''