#NEWLINE# def compareWriteAndReloadConfig( config , config_file ) : #NEWLINE# #INDENT# runningConfig = str ( ) #NEWLINE# try : #NEWLINE# #INDENT# logger . debug ( 'reading running config from %s' , config_file ) #NEWLINE# with open ( config_file , 'r' ) as f : #NEWLINE# #INDENT# runningConfig = f . read ( ) #NEWLINE# #UNINDENT# #UNINDENT# except IOError : #NEWLINE# #INDENT# logger . warning ( "couldn't open config file for reading" ) #NEWLINE# #UNINDENT# if ( runningConfig != config ) : #NEWLINE# #INDENT# logger . info ( 'running config is different from generated config - reloading' ) #NEWLINE# if writeConfigAndValidate ( config , config_file ) : #NEWLINE# #INDENT# reloadConfig ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'skipping reload: config not valid' )