#NEWLINE# def mod_run_check( cmd_kwargs , onlyif , unless ) : #NEWLINE# #INDENT# '\n    Execute the onlyif and unless logic. Return a result dict if:\n\n    * onlyif failed (onlyif != 0)\n    * unless succeeded (unless == 0)\n\n    Otherwise, returns ``True``\n    ' #NEWLINE# cmd_kwargs = copy . deepcopy ( cmd_kwargs ) #NEWLINE# cmd_kwargs [ 'python_shell' ] = True #NEWLINE# if onlyif : #NEWLINE# #INDENT# if ( __salt__ [ 'cmd.retcode' ] ( unless , ** cmd_kwargs ) != 0 ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'comment' : 'onlyif execution failed' , #NEWLINE# 'skip_watch' : True , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# if unless : #NEWLINE# #INDENT# if ( __salt__ [ 'cmd.retcode' ] ( unless , ** cmd_kwargs ) == 0 ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'comment' : 'unless execution succeeded' , #NEWLINE# 'skip_watch' : True , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# return True