From: Tony Mack Date: Fri, 18 Jan 2008 17:51:34 +0000 (+0000) Subject: -support vserver and chroot myplc. -use utils.popen instead of os.popen3 X-Git-Tag: 2008-02-11-last-vmware-support~142 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6f0dbf1e1fffba82ccbd3b03e1ddfb5eafa85f14;p=tests.git -support vserver and chroot myplc. -use utils.popen instead of os.popen3 --- diff --git a/qaapi/qa/modules/plc/stop.py b/qaapi/qa/modules/plc/stop.py index 9e250ca..990cbe9 100644 --- a/qaapi/qa/modules/plc/stop.py +++ b/qaapi/qa/modules/plc/stop.py @@ -1,15 +1,33 @@ import os, sys import traceback from qa.Test import Test +from qa import utils class stop(Test): """ Installs a myplc """ - def call(self): - (stdin, stdout, stderr) = os.popen3('set -x ; service plc stop') - self.errors = stderr.readlines() - if self.errors: raise "\n".join(self.errors) + def call(self, system_type, vserver_or_root_dir_name): + + stop command = " /sbin/service plc stop " + full_command = "" + if system_type in ['vserv', 'vserver']: + full_command += " vserver %(vserver_or_root_dir_name)s exec " + elif system_type in ['chroot']: + pass + else: + raise Exception, "Invalid system type %(system_type)s" locals() + + full_command += stop_command + full_command = full_command % locals() + + if self.config.verbose: + utils.header(full_command) + + (stdout, stderr) = utils.popen(full_command) + + if self.config.verbose: + utils.header("\n".join(stdout)) return 1