#NEWLINE# def _runCommand( self , command , path ) : #NEWLINE# #INDENT# if ( not ( ( command + '-command' ) in self . config ) ) : #NEWLINE# #INDENT# syslog ( LOG_WARNING , ( "Command '%s' doesn't exist in config" % ( command , ) ) ) #NEWLINE# return #NEWLINE# #UNINDENT# confSect = self . config [ ( command + '-command' ) ] #NEWLINE# configMode = confSect . get ( 'Mode' , 'once' ) . lower ( ) #NEWLINE# suppressOutput = confSect . getboolean ( 'SuppressOutput' , True ) #NEWLINE# shell = confSect . getboolean ( 'Shell' , False ) #NEWLINE# if ( configMode == 'once' ) : #NEWLINE# #INDENT# self . _executePathCommand ( confSect [ 'Command' ] , path , path , suppressOutput , shell ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( configMode == 'file' ) : #NEWLINE# #INDENT# regExpStmt = confSect . get ( 'RegExp' , None ) #NEWLINE# files = self . _getFiles ( path , regExpStmt = regExpStmt ) #NEWLINE# for file in files : #NEWLINE# #INDENT# self . _executePathCommand ( confSect [ 'Command' ] , file , path , suppressOutput , shell ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# syslog ( LOG_WARNING , ( "Encountered unknown command mode '%s' while running command '%s' on '%s'" % ( configMode , command , path ) ) )