#NEWLINE# def single( fun , name , test = None , queue = False , **kwargs ) : #NEWLINE# #INDENT# "\n    Execute a single state function with the named kwargs, returns False if\n    insufficient data is sent to the command\n\n    By default, the values of the kwargs will be parsed as YAML. So, you can\n    specify lists values, or lists of single entry key-value maps, as you\n    would in a YAML salt file. Alternatively, JSON format of keyword values\n    is also supported.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' state.single pkg.installed name=vim\n\n    " #NEWLINE# conflict = _check_queue ( queue , kwargs ) #NEWLINE# if ( conflict is not None ) : #NEWLINE# #INDENT# return conflict #NEWLINE# #UNINDENT# comps = fun . split ( '.' ) #NEWLINE# if ( len ( comps ) < 2 ) : #NEWLINE# #INDENT# __context__ [ 'retcode' ] = 1 #NEWLINE# return 'Invalid function passed' #NEWLINE# #UNINDENT# kwargs . update ( { #NEWLINE# #INDENT# 'state' : comps [ 0 ] , #NEWLINE# 'fun' : comps [ 1 ] , #NEWLINE# '__id__' : name , #NEWLINE# 'name' : name , #NEWLINE# #UNINDENT# } ) #NEWLINE# orig_test = __opts__ . get ( 'test' , None ) #NEWLINE# opts = _get_opts ( kwargs . get ( 'localconfig' ) ) #NEWLINE# if salt . utils . test_mode ( test = test , ** kwargs ) : #NEWLINE# #INDENT# opts [ 'test' ] = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# opts [ 'test' ] = __opts__ . get ( 'test' , None ) #NEWLINE# #UNINDENT# pillar = kwargs . get ( 'pillar' ) #NEWLINE# pillar_enc = kwargs . get ( 'pillar_enc' ) #NEWLINE# if ( ( pillar_enc is None ) and ( pillar is not None ) and ( not isinstance ( pillar , dict ) ) ) : #NEWLINE# #INDENT# raise SaltInvocationError ( 'Pillar data must be formatted as a dictionary, unless pillar_enc is specified.' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# st_ = salt . state . State ( opts , pillar , pillar_enc = pillar_enc , proxy = __proxy__ ) #NEWLINE# #UNINDENT# except NameError : #NEWLINE# #INDENT# st_ = salt . state . State ( opts , pillar , pillar_enc = fun ) #NEWLINE# #UNINDENT# err = st_ . verify_data ( kwargs ) #NEWLINE# if err : #NEWLINE# #INDENT# __context__ [ 'retcode' ] = 1 #NEWLINE# return err #NEWLINE# #UNINDENT# st_ . _mod_init ( kwargs ) #NEWLINE# ret = { #NEWLINE# #INDENT# '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}' . format ( kwargs ) : st_ . call ( kwargs ) , #NEWLINE# #UNINDENT# } #NEWLINE# _set_retcode ( ret ) #NEWLINE# __opts__ [ 'test' ] = orig_test #NEWLINE# return ret