def killStateChannel( self ): self.log.debug('Killing state channel for Action "%s"' % ( self.name )) if self.stateChannel: self.stateChannel.send(chr(3)) self.stateChannel.send( 'exit\n' ) if self.stateCommand: # non blocking commands, so only one shell required # kill both screens for start and stop command channel = self.component.host.invokeShell() cmd = self.createKillCmd( self.stateCommand ) channel.send(cmd) self.state = None EventHistory.newState( self, self.component, self.state )
def notifyNewStatusLine( self, screen, line ): configurationStart = line.rfind( '<configuration>' ) configurationEnd = line.rfind( '</configuration' ) if configurationStart < 0 or configurationEnd < 0: return configTxt = line[ configurationStart : configurationEnd ] code = '' codeStart = configTxt.find( '<code>' ) codeEnd = configTxt.find( '</code>' ) if codeStart >= 0 and codeEnd >= 0: code = configTxt[ codeStart+len( '<code>' ) : codeEnd ] message = '' messageStart = configTxt.find( '<message>' ) messageEnd = configTxt.find( '</message>' ) if messageStart >= 0 and messageEnd >= 0: message = configTxt[ messageStart+len( '<message>' ) : messageEnd ] if not self.state or self.state[ 'code' ] != code or self.state[ 'message' ] != message: print 'CODE: "%s", MESSGAGE: "%s"' % ( code, message ) self.state = { 'code': code, 'message': message } EventHistory.newState( self, self.component, self.state )