updated to support remote plcs and nodes
[tests.git] / qaapi / qa / tests / plc_uninstall.py
1 #!/usr/bin/python
2
3 import os, sys
4 import traceback
5 from Test import Test
6 from qa import utils
7
8 class plc_uninstall(Test):
9     """
10     Completely removes the installed myplc
11     """
12
13     def call(self, plc_name = None, remove_all = False):
14
15         # Get plc configuration from config
16         plc = PLC(self.config)
17         plcs = getattr(self.config, 'plcs', [])
18         for p in plcs:
19             if p['name'] in [plc_name]:
20                 plc.update(p)
21         
22         command = "/sbin/service plc safestop && rpm -e myplc " 
23         if remove_all:
24             command += " && rm -rf /plc/data" 
25
26         if self.config.verbose:
27             utils.header("Removing myplc")
28             utils.header("\n".join(command))
29         
30         (status, output) = plc.commands(command)
31                 
32         if self.config.verbose:
33             utiils.header("\n".join(output))
34         
35         return 1
36
37 if __name__ == '__main__':
38     args = tuple(sys.argv[1:])
39     plc_unistall()(*args)