#NEWLINE# def enabled( name , **kwargs ) : #NEWLINE# #INDENT# '\n    Ensure a job is enabled in the schedule\n\n    name\n        The unique name that is given to the scheduled job.\n\n    persist\n        Whether the job should persist between minion restarts, defaults to True.\n\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'result' : True , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'comment' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# current_schedule = __salt__ [ 'schedule.list' ] ( show_all = True , return_yaml = False ) #NEWLINE# if ( name in current_schedule ) : #NEWLINE# #INDENT# if ( ( 'test' in __opts__ ) and __opts__ [ 'test' ] ) : #NEWLINE# #INDENT# kwargs [ 'test' ] = True #NEWLINE# result = __salt__ [ 'schedule.enable_job' ] ( name , ** kwargs ) #NEWLINE# ret [ 'comment' ] . append ( result [ 'comment' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = __salt__ [ 'schedule.enable_job' ] ( name , ** kwargs ) #NEWLINE# if ( not result [ 'result' ] ) : #NEWLINE# #INDENT# ret [ 'result' ] = result [ 'result' ] #NEWLINE# ret [ 'comment' ] = result [ 'comment' ] #NEWLINE# return ret #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret [ 'comment' ] . append ( 'Enabled job {0} from schedule' . format ( name ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ret [ 'comment' ] . append ( 'Job {0} not present in schedule' . format ( name ) ) #NEWLINE# #UNINDENT# ret [ 'comment' ] = '\n' . join ( ret [ 'comment' ] ) #NEWLINE# return ret