-remove unnecessary code
[tests.git] / qaapi / qa / modules / plc / uninstall.py
1 import os, sys
2 import traceback
3 from qa.Test import Test
4 from qa import utils
5
6 class uninstall(Test):
7     """
8     Completely removes the installed myplc
9     """
10
11     def call(self, system_type, root_dir):
12         
13         remove_command = " rpm -e myplc " 
14         full_command = ""
15
16         if system_type in ['vserv', 'vserver']:
17             full_command += " vserver %(root_dir)s exec "
18         elif system_type in ['chroot']:
19             pass
20         else: 
21             raise Exception, "Invalid system type %(system_type)s" % locals()
22          
23         if self.config.verbose:
24             utils.header("Removing myplc")
25
26         full_command = full_command % locals()
27         (stdout, stderr) = utils.popen(full_command + "service plc safestop")
28         if self.config.verbose:
29             utils.header("\n".join(stdout))
30                 
31         (stdin, stdout, stderr) = utils.popen(full_command + remove_command)
32         if self.config.verbose:
33             utils.header("\n".join(stdout))
34
35         (stdin, stdout, stderr) = utils.popen(full_command + " rm -rf  /plc/data")
36         if self.config.verbose:
37             utiils.header("\n".join(stdout))
38         
39         return 1