[Supervisor-checkins] r811 - supervisor/trunk/src/supervisor

Chris McDonough chrism at agendaless.com
Wed Aug 27 00:02:17 EDT 2008


Author: Chris McDonough <chrism at agendaless.com>
Date: Wed Aug 27 00:02:16 2008
New Revision: 811

Log:
Use state imports rather than state names.


Modified:
   supervisor/trunk/src/supervisor/supervisorctl.py

Modified: supervisor/trunk/src/supervisor/supervisorctl.py
==============================================================================
--- supervisor/trunk/src/supervisor/supervisorctl.py	(original)
+++ supervisor/trunk/src/supervisor/supervisorctl.py	Wed Aug 27 00:02:16 2008
@@ -47,6 +47,7 @@
 from supervisor.options import ClientOptions
 from supervisor.options import split_namespec
 from supervisor import xmlrpc
+from supervisor import states
 
 class fgthread(threading.Thread):
     """ A subclass of threading.Thread, with a kill() method.
@@ -920,7 +921,7 @@
             # for any other fault
             self.ctl.output(str(msg))
             return
-        if not info['statename'] == 'RUNNING':
+        if not info['state'] == states.ProcessStates.RUNNING:
             self.ctl.output('Error: process not running')
             return
         # everything good; continue
@@ -933,15 +934,15 @@
                 # this takes care of the user input
                 inp = raw_input() + '\n'
                 try:
-                    supervisor.sendProcessStdin(program,inp)
+                    supervisor.sendProcessStdin(program, inp)
                 except xmlrpclib.Fault, msg:
-                    if msg.faultCode == 70:
+                    if msg.faultCode == xmlrpc.Faults.NOT_RUNNING:
                         self.ctl.output('Process got killed')
                         self.ctl.output('Exiting foreground')
                         a.kill()
                         return
                 info = supervisor.getProcessInfo(program)
-                if not info['statename'] == 'RUNNING':
+                if not info['state'] == states.ProcessStates.RUNNING:
                     self.ctl.output('Process got killed')
                     self.ctl.output('Exiting foreground')
                     a.kill()


More information about the Supervisor-checkins mailing list