#NEWLINE# @ Text ( 'announce operational' ) #NEWLINE# def announce_operational( self , reactor , service , command ) : #NEWLINE# #INDENT# def callback( self , command , peers ) : #NEWLINE# #INDENT# operational = self . parser . api_operational ( command ) #NEWLINE# if ( not operational ) : #NEWLINE# #INDENT# self . log_failure ( ( 'Command could not parse operational command : %s' % command ) ) #NEWLINE# reactor . answer ( service , 'error' ) #NEWLINE# ( yield True ) #NEWLINE# return #NEWLINE# #UNINDENT# reactor . configuration . inject_operational ( peers , operational ) #NEWLINE# self . log_message ( ( 'operational message sent to %s : %s' % ( ( ', ' . join ( ( peers if peers else [ ] ) ) if ( peers is not None ) else 'all peers' ) , operational . extensive ( ) ) ) ) #NEWLINE# ( yield False ) #NEWLINE# reactor . route_update = True #NEWLINE# reactor . answer ( service , 'done' ) #NEWLINE# #UNINDENT# if ( ( command . split ( ) + [ 'be' , 'safe' ] ) [ 2 ] . lower ( ) not in ( 'asm' , 'adm' , 'rpcq' , 'rpcp' , 'apcq' , 'apcp' , 'lpcq' , 'lpcp' ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( descriptions , command ) = self . parser . extract_neighbors ( command ) #NEWLINE# peers = reactor . match_neighbors ( descriptions ) #NEWLINE# if ( not peers ) : #NEWLINE# #INDENT# self . log_failure ( ( 'no neighbor matching the command : %s' % command ) , 'warning' ) #NEWLINE# reactor . answer ( service , 'error' ) #NEWLINE# return False #NEWLINE# #UNINDENT# reactor . plan ( callback ( self , command , peers ) , 'announce_operational' ) #NEWLINE# return True #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# self . log_failure ( 'issue parsing the command' ) #NEWLINE# reactor . answer ( service , 'error' ) #NEWLINE# return False #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# self . log_failure ( 'issue parsing the command' ) #NEWLINE# reactor . answer ( service , 'error' ) #NEWLINE# return False