simplify
[tests.git] / qaapi / qa / tests / plc_start.py
1 #!/usr/bin/python
2
3 import traceback
4 import sys
5 from Test import Test
6 from qa import utils
7 from qa.PLCs import PLC, PLCs
8
9 class plc_start(Test):
10     """
11     Starts the myplc service
12     """
13
14     def call(self, plc_name = None):
15
16         # Get plc configuration from config
17         plc = self.config.get_plc(plc_name)
18         command = "/sbin/service plc start "
19         if self.config.verbose:
20             utils.header(command)       
21         (status, output) = plc.commands(command)
22
23         if self.config.verbose:
24             utils.header(output)
25
26         # Some plcs may fail when trying to start the http/xmlrpc server 
27         # because the port is already in use. We must start a server on 
28         # another port.
29         plc.start_xmlrpc_server()  
30   
31         
32         return 1
33
34 if __name__ == '__main__':
35     args = tuple(sys.argv[1:])
36     plc_start()(*args)