#NEWLINE# def persist( self ) : #NEWLINE# #INDENT# '\n        Persist the modified schedule into <<configdir>>/minion.d/_schedule.conf\n        ' #NEWLINE# config_dir = self . opts . get ( 'conf_dir' , None ) #NEWLINE# if ( ( config_dir is None ) and ( 'conf_file' in self . opts ) ) : #NEWLINE# #INDENT# config_dir = os . path . dirname ( self . opts [ 'conf_file' ] ) #NEWLINE# #UNINDENT# if ( config_dir is None ) : #NEWLINE# #INDENT# config_dir = salt . syspaths . CONFIG_DIR #NEWLINE# #UNINDENT# minion_d_dir = os . path . join ( config_dir , os . path . dirname ( self . opts . get ( 'default_include' , salt . config . DEFAULT_MINION_OPTS [ 'default_include' ] ) ) ) #NEWLINE# if ( not os . path . isdir ( minion_d_dir ) ) : #NEWLINE# #INDENT# os . makedirs ( minion_d_dir ) #NEWLINE# #UNINDENT# schedule_conf = os . path . join ( minion_d_dir , '_schedule.conf' ) #NEWLINE# log . debug ( 'Persisting schedule' ) #NEWLINE# try : #NEWLINE# #INDENT# with salt . utils . fopen ( schedule_conf , 'wb+' ) as fp_ : #NEWLINE# #INDENT# fp_ . write ( salt . utils . to_bytes ( yaml . dump ( { #NEWLINE# #INDENT# 'schedule' : self . opts [ 'schedule' ] , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except ( IOError , OSError ) : #NEWLINE# #INDENT# log . error ( 'Failed to persist the updated schedule' , exc_info_on_loglevel = logging . DEBUG )