autorun: fixed Commander error function invalid reference
authorMarius Sandu-Popa <sandupopamarius@gmail.com>
Fri, 30 Apr 2010 12:55:02 +0000 (15:55 +0300)
committerMarius Sandu-Popa <sandupopamarius@gmail.com>
Fri, 30 Apr 2010 12:55:12 +0000 (15:55 +0300)
autorun/commander/Commander.py
autorun/commander/CommanderBase.py

index f790ffd..6b34ade 100644 (file)
@@ -19,14 +19,14 @@ class Commander(Thread):
                self.Commander = CommanderBase();       
                self.commands = {
                'list': [self.simpleC,  'Lists the nodes in xml file.'],
-               'boot':[self.nodeC,     'Bootstrap server. Options: all | x .'],
-               'start': [self.clientC, 'Start clients. Options: all | x | x,y .'],
-               'stop': [self.clientC,  'Stop clients. Options: all | x | x,y .'],
-               'status': [self.clientC,'Status clients. Options: all | x | x,y .'],
+               'boot':[self.nodeC,     'Bootstrap server. Options: all | x'],
+               'start': [self.clientC, 'Start clients. Options: all | x | x,y'],
+               'stop': [self.clientC,  'Stop clients. Options: all | x | x,y'],
+               'status': [self.clientC,'Status clients. Options: all | x | x,y'],
                'archive': [self.nodeC, 'Archive output information of clients.'+\
-                                       'Options: all | x .'],
-               'getclients': [self.nodeC,'Get running clients. Options: all | x .'],
-               'getoutput': [self.nodeC,'Get clients output. Options: all | x .'],
+                                       'Options: all | x'],
+               'getclients': [self.nodeC,'Get running clients. Options: all | x'],
+               'getoutput': [self.nodeC,'Get clients output. Options: all | x'],
                'help': [self.simpleC,  'Show This Message.'],
                'exit': [self.simpleC,  'Exit Commander.']
                }
@@ -251,7 +251,7 @@ class Commander(Thread):
                        " KB/s" + ", Up:" +si.upload_limit  + " KB/s" + ' )' 
        
        def about(self):
-               print "Commander version 1.1.1"
+               print "Commander version 1.1"
                print "Enter \"help\" for instructions"
        
 if __name__ == "__main__":
index c1c2f77..49acca8 100644 (file)
@@ -44,79 +44,79 @@ class CommanderBase():
        def getClients(self, public_address, listen_port):      
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       GET_CLIENTS, 
-                                                                                       "")
+                                       listen_port, 
+                                       GET_CLIENTS, 
+                                       "")
                        if msg_type == ACK_MSG:
                                return msg_data
                        else:
-                               error("get_clients", msg_data)
+                               self.error("get_clients", msg_data)
                except Exception, e:
                        print e
 
        def getOutput(self, public_address, listen_port):
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       GET_OUTPUT, 
-                                                                                       "")
+                                       listen_port, 
+                                       GET_OUTPUT, 
+                                       "")
                        if msg_type == ACK_MSG:
                                return msg_data
                        else:
-                               error("get_output", msg_data)
+                               self.error("get_output", msg_data)
                except Exception, e:
                        print e
        
        def archive(self, public_address, listen_port):
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       ARCHIVE, 
-                                                                                       "")
+                                       listen_port, 
+                                       ARCHIVE, 
+                                       "")
                        if msg_type == ACK_MSG:
                                return msg_data
                        else:
-                               error("archive", msg_data)
+                               self.error("archive", msg_data)
                except Exception, e:
                        print e
 
        def start(self, public_address, listen_port, config_data):
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       START_MSG, 
-                                                                                       config_data)
+                                       listen_port, 
+                                       START_MSG, 
+                                       config_data)
                        if msg_type == ACK_MSG:
                                return msg_data
                        else:
-                               error("start_client", msg_data)
+                               self.error("start_client", msg_data)
                except Exception, e:
                        print e
        
        def stop(self, public_address, listen_port, client_pid):
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       STOP_MSG,
-                                                                                       client_pid) 
+                                       listen_port, 
+                                       STOP_MSG,
+                                       client_pid) 
                                
                        if msg_type == ACK_MSG:
                                return True
                        else:
-                               error("stop_client", msg_data)
+                               self.error("stop_client", msg_data)
                except Exception, e:
                        print e
        
        def status(self, public_address, listen_port, client_pid):      
                try:
                        msg_type, msg_data = self.sendComm(public_address, 
-                                                                                       listen_port, 
-                                                                                       GET_STATUS, 
-                                                                                       client_pid)
+                                       listen_port, 
+                                       GET_STATUS, 
+                                       client_pid)
                        if msg_type == ACK_MSG:
                                return msg_data
                        else:
-                               error("start_client", msg_data)
+                               self.error("start_client", msg_data)
                except Exception, e:
                        print e
        
@@ -126,4 +126,4 @@ class CommanderBase():
        def error(self, op, msg):
                print "[Server Error]: The server denied the " + op + " operation"
                print "[Server Error]: " + msg
-       
\ No newline at end of file
+