Bladeren bron

The fault ALREADY_TERMINATED has been removed. It was only raised by supervisor.sendProcessStdin(). That method now returns NOT_RUNNING for parity with the other methods.

Chris McDonough 17 jaren geleden
bovenliggende
commit
fb658b86ed
4 gewijzigde bestanden met toevoegingen van 12 en 9 verwijderingen
  1. 4 0
      CHANGES.txt
  2. 4 4
      src/supervisor/rpcinterface.py
  3. 4 4
      src/supervisor/tests/test_rpcinterfaces.py
  4. 0 1
      src/supervisor/xmlrpc.py

+ 4 - 0
CHANGES.txt

@@ -10,6 +10,10 @@ Next Release
     http://www.plope.com/software/collector/252 for more information.
     Thanks to William Dode.
 
+  - The fault ALREADY_TERMINATED has been removed.  It was only 
+    raised by supervisor.sendProcessStdin().  That method now returns 
+    NOT_RUNNING for parity with the other methods. (Mike Naberezny)
+
 3.0a3
 
   - Supervisorctl now reports a better error message when the main

+ 4 - 4
src/supervisor/rpcinterface.py

@@ -634,9 +634,9 @@ class SupervisorNamespaceRPCInterface:
         If non-7-bit data is sent (unicode), it is encoded to utf-8
         before being sent to the process' stdin.  If chars is not a
         string or is not unicode, raise INCORRECT_PARAMETERS.  If the
-        process has already been terminated, raise ALREADY_TERMINATED.
-        If the process' stdin cannot accept input (e.g. it was closed
-        by the child process), raise NO_FILE.
+        process is not running, raise NOT_RUNNING.  If the process' 
+        stdin cannot accept input (e.g. it was closed by the child 
+        process), raise NO_FILE.
 
         @param string name        The process name to send to (or 'group:name')
         @param string chars       The character data to send to the process
@@ -656,7 +656,7 @@ class SupervisorNamespaceRPCInterface:
             raise RPCError(Faults.BAD_NAME, name)
 
         if not process.pid or process.killing:
-            raise RPCError(Faults.ALREADY_TERMINATED, name)
+            raise RPCError(Faults.NOT_RUNNING, name)
 
         try:
             process.write(chars)

+ 4 - 4
src/supervisor/tests/test_rpcinterfaces.py

@@ -1327,18 +1327,18 @@ class SupervisorNamespaceXMLRPCInterfaceTests(TestBase):
                              interface.sendProcessStdin,
                              'nonexistant_process_name', 'chars for stdin')
 
-    def test_sendProcessStdin_raises_already_termed_when_not_process_pid(self):
+    def test_sendProcessStdin_raises_not_running_when_not_process_pid(self):
         options = DummyOptions()
         pconfig1 = DummyPConfig(options, 'process1', 'foo')
         supervisord = PopulatedDummySupervisor(options, 'process1', pconfig1)
         supervisord.set_procattr('process1', 'pid', 0)
         interface = self._makeOne(supervisord)
         from supervisor import xmlrpc
-        self._assertRPCError(xmlrpc.Faults.ALREADY_TERMINATED,
+        self._assertRPCError(xmlrpc.Faults.NOT_RUNNING,
                             interface.sendProcessStdin,
                             'process1', 'chars for stdin')
 
-    def test_sendProcessStdin_raises_already_termed_when_killing(self):
+    def test_sendProcessStdin_raises_not_running_when_killing(self):
         options = DummyOptions()
         pconfig1 = DummyPConfig(options, 'process1', 'foo')
         supervisord = PopulatedDummySupervisor(options, 'process1', pconfig1)
@@ -1346,7 +1346,7 @@ class SupervisorNamespaceXMLRPCInterfaceTests(TestBase):
         supervisord.set_procattr('process1', 'killing',True)
         interface   = self._makeOne(supervisord)
         from supervisor import xmlrpc
-        self._assertRPCError(xmlrpc.Faults.ALREADY_TERMINATED,
+        self._assertRPCError(xmlrpc.Faults.NOT_RUNNING,
                              interface.sendProcessStdin,
                              'process1', 'chars for stdin')
         

+ 0 - 1
src/supervisor/xmlrpc.py

@@ -44,7 +44,6 @@ class Faults:
     NOT_RUNNING = 70
     SUCCESS = 80
     TIMED_OUT = 90
-    ALREADY_TERMINATED = 200
 
 def getFaultDescription(code):
     for faultname in Faults.__dict__: