From aad4b7d74f7bfd272fd7ab601a61e7f2c4d0e64c Mon Sep 17 00:00:00 2001 From: "Ryan.RCS" Date: Tue, 20 Dec 2016 08:36:24 +0000 Subject: 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 --- yardstick/benchmark/scenarios/parser/parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'yardstick') 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 ''' -- cgit 1.2.3-korg