#NEWLINE# def run( self , conf , com , info ) : #NEWLINE# #INDENT# self . config = conf #NEWLINE# self . userInfo = info #NEWLINE# try : #NEWLINE# #INDENT# self . m_base . m_doc = minidom . parse ( self . config ) #NEWLINE# ( ret , msg ) = self . m_base . init ( ) #NEWLINE# if ( ret == False ) : #NEWLINE# #INDENT# if ( ( msg == self . m_base . const_init_ret_version ) or ( msg == self . m_base . const_init_ret_sde ) or ( msg == self . m_base . const_init_ret_patch ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# except Exception as inf : #NEWLINE# #INDENT# self . log ( ( ( ( ( 'Error: reading input config file:' + self . config ) + '\n' ) + str ( inf ) ) + '\nQuitting...' ) , self . const_critical_text ) #NEWLINE# return False #NEWLINE# #UNINDENT# self . processInfo = self . ProcessInfo . ProcessInfo ( self . m_base ) #NEWLINE# bSuccess = self . processInfo . init ( self . config ) #NEWLINE# if ( bSuccess == False ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# bSuccess = self . processInfo . hasProcessInfo #NEWLINE# self . log ( ( 'Using template:' + self . config ) , self . const_general_text ) #NEWLINE# com_ = com #NEWLINE# if ( com_ . upper ( ) == self . const_cmd_default_text . upper ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# com_ = self . getXMLNodeValue ( self . m_base . m_doc , 'Command' ) #NEWLINE# self . log ( ( 'Using default command(s):' + com_ ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log ( ( ( 'Error: Reading input config file:' + self . config ) + '\nQuitting...' ) , self . const_critical_text ) #NEWLINE# return False #NEWLINE# #UNINDENT# if ( len ( com_ . strip ( ) ) == 0 ) : #NEWLINE# #INDENT# self . log ( 'Error: Empty command.' , self . const_critical_text ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# self . log ( ( 'Processing command(s):' + com_ . upper ( ) ) , self . const_general_text ) #NEWLINE# aryCmds = com_ . split ( '+' ) #NEWLINE# for command in aryCmds : #NEWLINE# #INDENT# ucCommand = command #NEWLINE# command = command . upper ( ) #NEWLINE# is_user_cmd = False #NEWLINE# cmd = '' . join ( ( ch for ch in command if ( ch in ascii_letters ) ) ) #NEWLINE# index = 0 #NEWLINE# if ( len ( command ) > len ( cmd ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# index = int ( command [ len ( cmd ) : ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log ( ( 'Command/Err: Invalid command index:' + command ) , self . const_warning_text ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( cmd in self . commands . keys ( ) ) == False ) : #NEWLINE# #INDENT# if ( self . isUser_Function ( ucCommand ) == True ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . commands [ ucCommand ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . commands [ ucCommand ] [ 'desc' ] = ( 'User defined command (%s)' % ucCommand ) #NEWLINE# self . commands [ ucCommand ] [ 'fnc' ] = self . commands [ 'CM' ] [ 'fnc' ] #NEWLINE# cmd = ucCommand #NEWLINE# is_user_cmd = True #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log ( ( 'Unabled to add user defined function/command (%s) to command chain.' % ucCommand ) , self . const_warning_text ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . log ( ( 'Command/Err: Unknown command:' + cmd ) , self . const_warning_text ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# indexed_cmd = ( False if ( index == 0 ) else True ) #NEWLINE# cat_cmd = ( '%s%s' % ( cmd , ( '' if ( not indexed_cmd ) else index ) ) ) #NEWLINE# if ( self . isLog ( ) == True ) : #NEWLINE# #INDENT# self . m_log . CreateCategory ( cat_cmd ) #NEWLINE# #UNINDENT# self . log ( ( ( ( 'Command:' + cat_cmd ) + '->' ) + ( '%s' % self . commands [ cmd ] [ 'desc' ] ) ) , self . const_general_text ) #NEWLINE# if indexed_cmd : #NEWLINE# #INDENT# self . log ( ( 'Using parameter values at index (%s)' % index ) , self . const_general_text ) #NEWLINE# #UNINDENT# success = 'OK' #NEWLINE# status = self . commands [ cmd ] [ 'fnc' ] ( ch , cmd , index ) #NEWLINE# if ( status == False ) : #NEWLINE# #INDENT# success = 'Failed!' #NEWLINE# #UNINDENT# self . log ( success , self . const_status_text ) #NEWLINE# if ( self . isLog ( ) == True ) : #NEWLINE# #INDENT# self . m_log . CloseCategory ( ) #NEWLINE# #UNINDENT# if ( ( status == False ) and ( ( cmd == 'AR' ) or ( cmd == 'CM' ) or ( is_user_cmd == True ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# return True