mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 10:02:55 +00:00 
			
		
		
		
	Introduce intent for TFW messages and fix FSM related bugs
This commit is contained in:
		
				
					committed by
					
						
						therealkrispet
					
				
			
			
				
	
			
			
			
						parent
						
							f626fef8f8
						
					
				
				
					commit
					2e5867cc49
				
			@@ -1,6 +1,4 @@
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
from tfw.internals.networking import Scope
 | 
			
		||||
from tfw.internals.networking import Scope, Intent
 | 
			
		||||
from tfw.internals.inotify import InotifyObserver
 | 
			
		||||
 | 
			
		||||
from .supervisor import ProcessLogManager
 | 
			
		||||
@@ -33,4 +31,4 @@ class LogInotifyObserver(InotifyObserver, ProcessLogManager):
 | 
			
		||||
            'key': 'process.log.new',
 | 
			
		||||
            'stdout': self.read_stdout(self.process_name, tail=self.log_tail),
 | 
			
		||||
            'stderr': self.read_stderr(self.process_name, tail=self.log_tail)
 | 
			
		||||
        }, Scope.BROADCAST)
 | 
			
		||||
        }, Scope.BROADCAST, Intent.EVENT)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import logging
 | 
			
		||||
from xmlrpc.client import Fault as SupervisorFault
 | 
			
		||||
 | 
			
		||||
from tfw.internals.networking import Scope
 | 
			
		||||
from tfw.internals.networking import Scope, Intent
 | 
			
		||||
 | 
			
		||||
from .supervisor import ProcessManager
 | 
			
		||||
 | 
			
		||||
@@ -26,7 +26,7 @@ class ProcessHandler(ProcessManager):
 | 
			
		||||
                self.commands[message['key']](message['name'])
 | 
			
		||||
            except SupervisorFault as fault:
 | 
			
		||||
                message['error'] = fault.faultString
 | 
			
		||||
            connector.send_message(message, scope=Scope.WEBSOCKET)
 | 
			
		||||
            connector.send_message(message, scope=Scope.BROADCAST, intent=Intent.EVENT)
 | 
			
		||||
        except KeyError:
 | 
			
		||||
            if not message['key'].startswith('process.log'):
 | 
			
		||||
                LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user