%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/state.pyo

�
���^c@@sxdZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZm Z ddl!m"a#ddl$m%Z%ddl&m'Z'ddl(Z(dgZ)id	d
6d	d6d	d6d	d
6d	d6d	d	6d	d6d	d6d	d6d	d6d	d6d	d6Z*idd6Z+ej,e-�Z.dZ/d�Z0d�Z1e2d�Z3e2d�Z4d�Z5d�Z6d�Z7e2d�Z8e2d�Z9e2d �Z:e2e2d!�Z;e2d"�Z<d#e2e2e2e2d$�Z"e=d%�Z>d&�Z?d'�Z@d(�ZAe=d)�ZBe2d*�ZCe2e=d+�ZDe=d,�ZEe=d-�ZFe2d.�ZGe2d/�ZHe2d0�ZIe2d1�ZJd2d3�ZKe2e=d4�ZLe2e2e=e2d5�ZMe2e=d6�ZNe=d7�ZOe=d8�ZPe=d9�ZQe=d:�ZRe2e=d;�ZSe2e=d<�ZTe2e=d=�ZUe2e=d>�ZVe2e=d?�ZWe=d@�ZXe2e=dA�ZYdB�ZZe2dC�Z[dD�Z\dE�Z]dF�Z^dG�Z_ddHe=e2e=dIdJ�Z`dS(KuB
Control the state system on the minion.

State Caching
-------------

When a highstate is called, the minion automatically caches a copy of the last
high data. If you then run a highstate with cache=True it will use that cached
highdata and won't hit the fileserver except for ``salt://`` links in the
states themselves.
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationError(torchestrate(tOrderedDict(tsixu*u	highstateuslsusls_idupkgutopusingleutemplateutemplate_struapply_urequestu
check_requesturun_requestuapplyustatecC@stjjjtt��atS(u
    Set the virtualname
    (tsalttutilst	functoolstnamespaced_functiont_orchestratetglobalst__virtualname__(((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt__virtual__LscC@s#td�tj|�D��}|S(u7
    Filter out the result: True + no changes data
    cs@s6|],\}}|ds$|dr||fVqdS(uresultuchangesN((t.0ttagtvalue((s6/usr/lib/python2.7/site-packages/salt/modules/state.pys	<genexpr>[s	(tdictRt	iteritems(trunningstret((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_filter_runningWscC@sitjjjtd<t|t�r9tjjjtd<dStd|d|�setjjj	td<ndS(uJ
    Set the return code based on the data back from the state system
    uretcodeNustate.check_resultt	highstate(
Rtdefaultst	exitcodestEX_OKt__context__t
isinstancetlisttEX_STATE_COMPILER_ERRORt	__utils__tEX_STATE_FAILURE(RR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_set_retcode`scC@s8|jd�rdS|pijdtjd��p7dS(u�
    Checks all pillars (external and internal) for errors.
    Return an error message, if anywhere or None.

    :param kwargs: dictionary of options
    :param pillar: external pillar
    :return: None or an error message
    uforceu_errorsN(tgettNonet
__pillar__(tkwargstpillar((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_get_pillar_errorsos	cC@sZ|dkr$tjjjt�}nt|�}x#|rUtjd�t|�}q3WdS(uF
    Wait for all previously started state jobs to finish running
    iN(	R$RR	tjidtgen_jidt__opts__t_prior_running_statesttimetsleep(R)tstates((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_wait{s	
c
C@s�d
}y[|dr`tjd�r`tddtjdd�ddd	d
j|�d|�}nWn!tk
r�tjd|�nX|S(u'
    Create a snapper pre snapshot
    utestusnapper_statesusnapper.create_snapshottconfigusnapper_states_configuroott
snapshot_typeupretdescriptionuSalt State run for jid {0}t	__pub_jidu1Failed to create snapper pre snapshot for jid: %sN(R$R+R#t__salt__tformatt	Exceptiontlogterror(toptsR)tsnapper_pre((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_snapper_pre�s

c
C@s�ye|drdtjd�rd|rdtddtjdd�ddd	|d
dj|�d|�nWn!tk
r�tjd
|�nXdS(u)
    Create the post states snapshot
    utestusnapper_statesusnapper.create_snapshotR1usnapper_states_configurootR2upostt
pre_numberR3uSalt State run for jid {0}R4u1Failed to create snapper pre snapshot for jid: %sN(R+R#R5R6R7R8R9(R:R)tpre_num((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
_snapper_post�s 

cC@s�tjjtdd�}tjj||�}tjj|�shytj|�Wqhtk
rdqhXni}|dk	r�||kr�i||<q�ntjj|�r�tj	j
j|d��}tj
|j��}WdQXn||fS(u6
    Return the pause information for a given jid
    ucachedirustate_pauseurbN(tostpathtjoinR+texiststmakedirstOSErrorR$RR	tfilestfopentmsgpacktloadstread(R)tstate_idt	pause_dirt
pause_pathtdatatfp_((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
_get_pause�s
c
C@sCi}tdd�}tjjtdd�}tjj|�sE|S|dkrctj|�}n9t|t	�r�t
jjj
|�}ntj|�g}x�|D]�}t}x'|D]}|d|kr�t}q�q�W|sy&tjj||�}tj|�Wq�tk
rq�Xq�nt|�\}	}|	||<q�W|S(u�
    Get a report on all of the currently paused state runs and pause
    run settings.
    Optionally send in a jid if you only desire to see a single pause
    data set.
    usaltutil.is_runningustate.*ucachedirustate_pauseujidN(R5R@RARBR+RCR$tlistdirRRRR	RNt	stringifyRt	text_typetFalsetTruetremoveRERP(
R)RtactiveRLtjidstscan_jidt	is_activetactive_dataRMRN((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
get_pauses�s2



cC@s�tj|�}|dkr$d}nt||�\}}t||d<tjjj|d��}|j	t
j|��WdQXdS(u�
    Set up a state run to die before executing the given state id,
    this instructs a running state to safely exit at a given
    state id. This needs to pass in the jid of the running state.
    If a state_id is not passed then the jid referenced will be safely exited
    at the beginning of the next state run.

    The given state id is the id got a given state execution, so given a state
    that looks like this:

    .. code-block:: yaml

        vim:
          pkg.installed: []

    The state_id to pass to `soft_kill` is `vim`

    CLI Examples:

    .. code-block:: bash

        salt '*' state.soft_kill 20171130110407769519
        salt '*' state.soft_kill 20171130110407769519 vim
    u__all__ukilluwbN(RRSR$RPRURR	RFRGtwriteRHtdumps(R)RKRNRMRO((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt	soft_kill�s	cC@s�tj|�}|dkr$d}nt||�\}}|rVt|�||d<ntjjj|d��}|j	t
j|��WdQXdS(u�
    Set up a state id pause, this instructs a running state to pause at a given
    state id. This needs to pass in the jid of the running state and can
    optionally pass in a duration in seconds. If a state_id is not passed then
    the jid referenced will be paused at the beginning of the next state run.

    The given state id is the id got a given state execution, so given a state
    that looks like this:

    .. code-block:: yaml

        vim:
          pkg.installed: []

    The state_id to pass to `pause` is `vim`

    CLI Examples:

    .. code-block:: bash

        salt '*' state.pause 20171130110407769519
        salt '*' state.pause 20171130110407769519 vim
        salt '*' state.pause 20171130110407769519 vim 20
    u__all__udurationuwbN(RRSR$RPtintRR	RFRGR]RHR^(R)RKtdurationRNRMRO((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytpauses	cC@s�tj|�}|dkr$d}nt||�\}}||krU|j|�n|dkrji}ntjjj|d��}|j	t
j|��WdQXdS(u
    Remove a pause from a jid, allowing it to continue. If the state_id is
    not specified then the a general pause will be resumed.

    The given state_id is the id got a given state execution, so given a state
    that looks like this:

    .. code-block:: yaml

        vim:
          pkg.installed: []

    The state_id to pass to `rm_pause` is `vim`

    CLI Examples:

    .. code-block:: bash

        salt '*' state.resume 20171130110407769519
        salt '*' state.resume 20171130110407769519 vim
    u__all__uwbN(RRSR$RPtpopRR	RFRGR]RHR^(R)RKRNRMRO((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytresume)s		ubasec
C@s+td|d|d|d|d|d|�S(u"
    .. versionadded:: 2016.11.0

    Execute the orchestrate runner from a masterless minion.

    .. seealso:: More Orchestrate documentation

        * :ref:`Full Orchestrate Tutorial <orchestrate-runner>`
        * :py:mod:`Docs for the ``salt`` state module <salt.states.saltmod>`

    CLI Examples:

    .. code-block:: bash

        salt-call --local state.orchestrate webserver
        salt-call --local state.orchestrate webserver saltenv=dev test=True
        salt-call --local state.orchestrate webserver saltenv=dev pillarenv=aws
    tmodstsaltenvttesttexcludeR't	pillarenv(R(ReRfRgRhR'Ri((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyRKscC@syg}|r|Stdd�}xR|D]J}dj|d|dtjjj|d�|d�}|j|�q'W|S(u
    Return a list of strings that contain state return data if a state function
    is already running. This function is used to prevent multiple state calls
    from being run at the same time.

    CLI Example:

    .. code-block:: bash

        salt '*' state.running
    usaltutil.is_runningustate.*uLThe function "{0}" is running as PID {1} and was started at {2} with jid {3}ufunupidujid(R5R6RR	R)tjid_to_timetappend(t
concurrentRRWRNterr((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytrunningks

cC@sxg}tdd�}x[|D]S}yt|d�}Wntk
rMqnX|t|�kr|j|�qqW|S(u�
    Return a list of dicts of prior calls to state functions.  This function is
    used to queue state calls so only one is run at a time.
    usaltutil.is_runningustate.*ujid(R5R`t
ValueErrorRk(R)RRWRNtdata_jid((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR,�s

cC@sX|rt|jd��n8td|jdt��}|rTtjjjtd<|SdS(uy
    Utility function to queue the state run if requested
    and to check for conflicts in currently running states
    u	__pub_jidRlu
concurrenturetcodeN(	R0R#RnRTRRRRR(tqueueR&tconflict((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_check_queue�scC@s4tjdd�dkr0|dtdkr0tSdS(Nu__cliu	salt-callu	pillarenv(R+R#R$R%(R:((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_get_initial_pillar�scK@s�t||�}|dk	r|Sytjjtdt�}Wn#tk
r`tjjt�}nX|j|�}|r�tj	j
jtd<|S|j
|�}t|t�r�tj	j
jtd<ntd|�r�tj	j
jtd<n|S(u
    Execute a single low data call

    This function is mostly intended for testing the state system and is not
    likely to be needed in everyday usage.

    CLI Example:

    .. code-block:: bash

        salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
    tproxyuretcodeustate.check_resultN(RsR$RtstatetStateR+t	__proxy__t	NameErrortverify_dataRRRRtcallRRR R!(RNRqR&Rrtst_RmR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytlow�s"

cK@szt}|dkrptjjjd||�r6t}qvtdddt�tkr[t}qvtjdd�}n|}|S(u8
    Determine the correct value for the test flag.
    Rgu
config.getutestt	omit_optsN(	RUR$RR	targst	test_modeR5R+R#(RgR&R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt_get_test_value�s		c
K@s4t||�}|d
k	r|Stjjjt|�}t||�|d<|jd�}|jd�}|d
kr�|d
k	r�t	|t
�r�td��ny7tjj||d|dt
dtdt|��}Wn8tk
rtjj||d|dt|��}nX|j|�}	t|	d	|�|	S(u,
    Execute the compound calls stored in a single set of high data

    This function is mostly intended for testing the state system and is not
    likely to be needed in everyday usage.

    CLI Example:

    .. code-block:: bash

        salt '*' state.high '{"vim": {"pkg": ["installed"]}}'
    utestupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.t
pillar_encRutcontexttinitial_pillarRN(RsR$RR	Rvtget_sls_optsR+R�R#RRRRwRxRRtRyt	call_highR"(
RNRgRqR&RrR:tpillar_overrideR�R|R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pythigh�s6

c		K@s�d|kr|jd�nt||�}|dk	r;|Stjjjt|�}y.tjj|dt	dt
dt|��}Wn5tk
r�tjj|dt	dt|��}nXt
|d|jd�}|rtjjjt	d<tdd	|��n|jd
�s$djd|�}n|j||jd
d�dddt�\}}|rqtjjjt	d<|S|jj|�}t|d|�|S(uL
    Execute the information stored in a template file on the minion.

    This function does not ask a master for a SLS file to render but
    instead directly processes the file at the provided path on the minion.

    CLI Example:

    .. code-block:: bash

        salt '*' state.template '<Path to template on the minion>'
    uenvR�RuR�R'upillaruretcodeuPillar failed to rendertinfou.slsu	{sls}.slstslsusaltenvutlocalRN(RcRsR$RR	RvR�R+t	HighStateRRxRtRyR(R:RRtEX_PILLAR_FAILURERtendswithR6trender_stateR#RURR�R"(	ttemRqR&RrR:R|terrorst
high_stateR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyttemplates@

	cK@s�t||�}|dk	r|Stjjjt|�}y(tjj|dtdt	|��}Wn/t
k
r�tjj|dt	|��}nX|j|�}t|�|S(u�
    Execute the information stored in a string from an sls template

    CLI Example:

    .. code-block:: bash

        salt '*' state.template_str '<Template String>'
    RuR�N(
RsR$RR	RvR�R+RwRxRtRytcall_template_strR"(R�RqR&RrR:R|R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyttemplate_strCs

"
cK@s|rt||�St|�S(u�
    .. versionadded:: 2015.5.0

    This function will call :mod:`state.highstate
    <salt.modules.state.highstate>` or :mod:`state.sls
    <salt.modules.state.sls>` based on the arguments passed to this function.
    It exists as a more intuitive way of applying states.

    .. rubric:: APPLYING ALL STATES CONFIGURED IN TOP.SLS (A.K.A. :ref:`HIGHSTATE <running-highstate>`)

    To apply all configured states, simply run ``state.apply``:

    .. code-block:: bash

        salt '*' state.apply

    The following additional arguments are also accepted when applying all
    states configured in top.sls:

    test
        Run states in test-only (dry-run) mode

    mock
        The mock option allows for the state run to execute without actually
        calling any states. This then returns a mocked return which will show
        the requisite ordering as well as fully validate the state run.

        .. versionadded:: 2015.8.4

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.apply stuff pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

    exclude
        Exclude specific states from execution. Accepts a list of sls names, a
        comma-separated string of sls names, or a list of dictionaries
        containing ``sls`` or ``id`` keys. Glob-patterns may be used to match
        multiple states.

        .. code-block:: bash

            salt '*' state.apply exclude=bar,baz
            salt '*' state.apply exclude=foo*
            salt '*' state.apply exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"

    queue : False
        Instead of failing immediately when another state run is in progress,
        queue the new state run to begin running once the other has finished.

        This option starts a new thread for each queued state run, so use this
        option sparingly.

    localconfig
        Optionally, instead of using the minion config, load minion opts from
        the file specified by this argument, and then merge them with the
        options from the minion config. This functionality allows for specific
        states to be run with their own custom minion configuration, including
        different pillars, file_roots, etc.

        .. code-block:: bash

            salt '*' state.apply localconfig=/path/to/minion.yml


    .. rubric:: APPLYING INDIVIDUAL SLS FILES (A.K.A. :py:func:`STATE.SLS <salt.modules.state.sls>`)

    To apply individual SLS files, pass them as a comma-separated list:

    .. code-block:: bash

        # Run the states configured in salt://stuff.sls (or salt://stuff/init.sls)
        salt '*' state.apply stuff
        # Run the states configured in salt://stuff.sls (or salt://stuff/init.sls)
        # and salt://pkgs.sls (or salt://pkgs/init.sls).
        salt '*' state.apply stuff,pkgs

    The following additional arguments are also accepted when applying
    individual SLS files:

    test
        Run states in test-only (dry-run) mode

    mock
        The mock option allows for the state run to execute without actually
        calling any states. This then returns a mocked return which will show
        the requisite ordering as well as fully validate the state run.

        .. versionadded:: 2015.8.4

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.apply stuff pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

    queue : False
        Instead of failing immediately when another state run is in progress,
        queue the new state run to begin running once the other has finished.

        This option starts a new thread for each queued state run, so use this
        option sparingly.

    concurrent : False
        Execute state runs concurrently instead of serially

        .. warning::

            This flag is potentially dangerous. It is designed for use when
            multiple state runs can safely be run at the same time. Do *not*
            use this flag for performance optimization.

    saltenv
        Specify a salt fileserver environment to be used when applying states

        .. versionchanged:: 0.17.0
            Argument name changed from ``env`` to ``saltenv``

        .. versionchanged:: 2014.7.0
            If no saltenv is specified, the minion config will be checked for an
            ``environment`` parameter and if found, it will be used. If none is
            found, ``base`` will be used. In prior releases, the minion config
            was not checked and ``base`` would always be assumed when the
            saltenv was not explicitly set.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    localconfig
        Optionally, instead of using the minion config, load minion opts from
        the file specified by this argument, and then merge them with the
        options from the minion config. This functionality allows for specific
        states to be run with their own custom minion configuration, including
        different pillars, file_roots, etc.

        .. code-block:: bash

            salt '*' state.apply stuff localconfig=/path/to/minion.yml

    sync_mods
        If specified, the desired custom module types will be synced prior to
        running the SLS files:

        .. code-block:: bash

            salt '*' state.apply stuff sync_mods=states,modules
            salt '*' state.apply stuff sync_mods=all

        .. note::
            This option is ignored when no SLS files are specified, as a
            :ref:`highstate <running-highstate>` automatically syncs all custom
            module types.

        .. versionadded:: 2017.7.8,2018.3.3,2019.2.0
    (R�R(ReR&((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytapply_^s�
cK@s-t|d<t||�}tjjtdd�}tjjt�}t	�}|j
ii|d6|d6|d6|jdd�6�tjj
jd	���yatjjj�r�td
dj|��ntjj
j|d��}|j||�Wd
QXWn'ttfk
r"tjd|�nXWd
QX|S(uJ
    .. versionadded:: 2015.5.0

    Request that the local admin execute a state run via
    `salt-call state.run_request`.
    All arguments match those of state.apply.

    CLI Example:

    .. code-block:: bash

        salt '*' state.request
        salt '*' state.request stuff
        salt '*' state.request stuff,pkgs
    utestucachedirureq_state.putest_runumodsukwargsunameudefaulti?ucmd.runuattrib -R "{0}"uw+bNu8Unable to write state request file %s. Check permission.(RUR�R@RARBR+RtpayloadtSerialt
check_requesttupdateR#R	RFt	set_umasktplatformt
is_windowsR5R6RGtdumptIOErrorRER8R9(ReR&Rtnotify_pathtserialtreqRO((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytrequests(
	cC@s�tjjtdd�}tjjt�}tjj|�rtjj	j
|d��}|j|�}WdQX|r{||S|SiS(u�
    .. versionadded:: 2015.5.0

    Return the state request information, if any

    CLI Example:

    .. code-block:: bash

        salt '*' state.check_request
    ucachedirureq_state.purbN(R@RARBR+RR�R�tisfileR	RFRGtload(tnameR�R�ROR�((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR�9scC@sItjjtdd�}tjjt�}tjj|�sAtS|suytj	|�WqEt
tfk
rqqEXn�t�}||kr�|j
|�ntStjjjd���yatjjj�r�tddj|��ntjjj|d��}|j||�WdQXWn't
tfk
r>tjd|�nXWdQXtS(	u�
    .. versionadded:: 2015.5.0

    Clear out the state execution request without executing it

    CLI Example:

    .. code-block:: bash

        salt '*' state.clear_request
    ucachedirureq_state.pi?ucmd.runuattrib -R "{0}"uw+bNu8Unable to write state request file %s. Check permission.(R@RARBR+RR�R�R�RURVR�RER�RcRTR	RFR�R�R�R5R6RGR�R8R9(R�R�R�R�RO((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
clear_requestPs0	udefaultcK@s�t�}||kriS||}d|ks;d|kr?iS||dj|�d|dkrx|djd�n|r�t|d|d�}y$tjtjjtdd��Wnt	t
fk
r�nX|SiS(u�
    .. versionadded:: 2015.5.0

    Execute the pending state request

    CLI Example:

    .. code-block:: bash

        salt '*' state.run_request
    umodsukwargsutestucachedirureq_state.p(R�R�RcR�R@RVRARBR+R�RE(R�R&R�tn_reqR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytrun_requestzs"	
$c
K@s\tdg�r;tjd�idd6dd6dd6}|St||�}|d%k	rZ|Stjdd%�}tjj	j
t|�}t||�|d<d	|kr�|jd	�nd
|kr�|d
|d
<nd|kr�|d|d<n|jd�}|jd
�}|d%krB|d%k	rBt
|t�rBtd��nyUtj	j|||jd�d|dtdtd|jdt�dt|��}	WnVtk
r�tj	j|||jd�d|d|jdt�dt|��}	nXt||	jd�}
|
r*tjjjtd<dg|
S|	j�|jd�}t||jdd��}zm|	jd|jdg�d|jdd%�d|jdd�d |jd!t�d"|jd#�d$|�}Wd%|	j�Xt
|t�rtd&d'd(�d)ks|jd)�rt |�}nt!|d*|	j"�t#||jdd�|�|td<|S(+u
    Retrieve the state data from the salt master for this minion and execute it

    test
        Run states in test-only (dry-run) mode

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.highstate stuff pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

        .. versionchanged:: 2016.3.0
            GPG-encrypted CLI Pillar data is now supported via the GPG
            renderer. See :ref:`here <encrypted-cli-pillar-data>` for details.

    pillar_enc
        Specify which renderer to use to decrypt encrypted data located within
        the ``pillar`` value. Currently, only ``gpg`` is supported.

        .. versionadded:: 2016.3.0

    exclude
        Exclude specific states from execution. Accepts a list of sls names, a
        comma-separated string of sls names, or a list of dictionaries
        containing ``sls`` or ``id`` keys. Glob-patterns may be used to match
        multiple states.

        .. code-block:: bash

            salt '*' state.highstate exclude=bar,baz
            salt '*' state.highstate exclude=foo*
            salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"

    saltenv
        Specify a salt fileserver environment to be used when applying states

        .. versionchanged:: 0.17.0
            Argument name changed from ``env`` to ``saltenv``.

        .. versionchanged:: 2014.7.0
            If no saltenv is specified, the minion config will be checked for a
            ``saltenv`` parameter and if found, it will be used. If none is
            found, ``base`` will be used. In prior releases, the minion config
            was not checked and ``base`` would always be assumed when the
            saltenv was not explicitly set.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    queue : False
        Instead of failing immediately when another state run is in progress,
        queue the new state run to begin running once the other has finished.

        This option starts a new thread for each queued state run, so use this
        option sparingly.

    localconfig
        Optionally, instead of using the minion config, load minion opts from
        the file specified by this argument, and then merge them with the
        options from the minion config. This functionality allows for specific
        states to be run with their own custom minion configuration, including
        different pillars, file_roots, etc.

    mock
        The mock option allows for the state run to execute without actually
        calling any states. This then returns a mocked return which will show
        the requisite ordering as well as fully validate the state run.

        .. versionadded:: 2015.8.4

    CLI Examples:

    .. code-block:: bash

        salt '*' state.highstate

        salt '*' state.highstate whitelist=sls1_to_run,sls2_to_run
        salt '*' state.highstate exclude=sls_to_exclude
        salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"

        salt '*' state.highstate pillar="{foo: 'Foo!', bar: 'Bar!'}"
    u	highstateuHSalt highstate run is disabled. To re-enable, run state.enable highstateunameuFalseuresultuDisableducommentutestuenvusaltenvu	pillarenvupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.u	__pub_jidR�RuR�tmockedumockR�uretcodeu4Pillar failed to render with the following messages:uorchestration_jidu
called localyRhuexcludetcacheucachet
cache_nameu
cache_nametforceuforcet	whitelistu	whitelisttorchestration_jidNu
config.optionu
state_datauuterseR($t	_disabledR8tdebugRsR$R+R#RR	RvR�R�RcRRRR�RxRRTRtRyR(R:RRR�tpush_activeR<tcall_highstatet
pop_activeR5RR"tbuilding_highstateR?(
RgRqR&RRrt	orig_testR:R�R�R|R�R�R;((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR�s�]



	
(
cK@s�|jdt�}d|kr.|jd�n|rJt|jd��n)t|�}|rstjjjt	d<|St
|t�r�t|�}nt|g�}|r�x!|D]}	t
jd|	|	�q�Wtjjjt	d<|Stjdd �}
tjjjt|�}t||�|d<|dd kr;d|d<n|jd	�}|jd
�}
|
d kr�|d k	r�t
|t�r�td��ntjjt�}tjjtdd
j|jdd���}|tkr�dg}n|d k	rtjjj|�}ng}d|kr9|dgkr9dg}nxT|D]L}y"t dj|�d|d�Wq@t!k
r�t
j"d|�q@Xq@WyUtjj#|||jd�d|
dt$dt	d|jdt�dt%|��}WnVt&k
r=tjj#|||jd�d|
d|jdt�dt%|��}nXt'|d|j(d	�}|r{tjjj)t	d<dg|S|jd�}tjj*j+d��o|jd�r
tjj,|�r
tjj*j-|d��)}|j.|�}|jj/||�SWd QXq
nWd QXt
|t0j1�r@tjj2j3t4|��}ntjjj|�}|j5�z�|j6i||d6�\}}|r�tjjjt	d<|S|r�tjjj|�}d!|kr�|d!j7|�q�||d!<nt8||jdd"��}|jj/||�}Wd |j9�Xt d#d$d%�d&ksN|jd&�r]t:|�}ntjjtdd'�}tjj*j+d��$ygtjj;j<�r�t d(d)d*|gd+t�ntjj*j-|d,��}|j=||�Wd QXWn't>t?fk
rt
j@d-|�nXtA||�|
td<yMtjj*j-|d,��/}y|j=||�WntBk
rynXWd QXWn't>t?fk
r�t
j@d.|�nXWd QXtC||jdd"�|�|S(/uc
    Execute the states in one or more SLS files

    test
        Run states in test-only (dry-run) mode

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.sls stuff pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override existing Pillar values set via
            ``pillar_roots`` or an external Pillar source.  Pillar values that
            are not included in the kwarg will not be overwritten.

        .. versionchanged:: 2016.3.0
            GPG-encrypted CLI Pillar data is now supported via the GPG
            renderer. See :ref:`here <encrypted-cli-pillar-data>` for details.

    pillar_enc
        Specify which renderer to use to decrypt encrypted data located within
        the ``pillar`` value. Currently, only ``gpg`` is supported.

        .. versionadded:: 2016.3.0

    exclude
        Exclude specific states from execution. Accepts a list of sls names, a
        comma-separated string of sls names, or a list of dictionaries
        containing ``sls`` or ``id`` keys. Glob-patterns may be used to match
        multiple states.

        .. code-block:: bash

            salt '*' state.sls foo,bar,baz exclude=bar,baz
            salt '*' state.sls foo,bar,baz exclude=ba*
            salt '*' state.sls foo,bar,baz exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"

    queue : False
        Instead of failing immediately when another state run is in progress,
        queue the new state run to begin running once the other has finished.

        This option starts a new thread for each queued state run, so use this
        option sparingly.

    concurrent : False
        Execute state runs concurrently instead of serially

        .. warning::

            This flag is potentially dangerous. It is designed for use when
            multiple state runs can safely be run at the same time. Do *not*
            use this flag for performance optimization.

    saltenv
        Specify a salt fileserver environment to be used when applying states

        .. versionchanged:: 0.17.0
            Argument name changed from ``env`` to ``saltenv``.

        .. versionchanged:: 2014.7.0
            If no saltenv is specified, the minion config will be checked for an
            ``environment`` parameter and if found, it will be used. If none is
            found, ``base`` will be used. In prior releases, the minion config
            was not checked and ``base`` would always be assumed when the
            saltenv was not explicitly set.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    localconfig

        Optionally, instead of using the minion config, load minion opts from
        the file specified by this argument, and then merge them with the
        options from the minion config. This functionality allows for specific
        states to be run with their own custom minion configuration, including
        different pillars, file_roots, etc.

    mock:
        The mock option allows for the state run to execute without actually
        calling any states. This then returns a mocked return which will show
        the requisite ordering as well as fully validate the state run.

        .. versionadded:: 2015.8.4

    sync_mods
        If specified, the desired custom module types will be synced prior to
        running the SLS files:

        .. code-block:: bash

            salt '*' state.sls stuff sync_mods=states,modules
            salt '*' state.sls stuff sync_mods=all

        .. versionadded:: 2017.7.8,2018.3.3,2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' state.sls core,edit.vim dev
        salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"

        salt '*' state.sls myslsfile pillar="{foo: 'Foo!', bar: 'Bar!'}"
    u
concurrentuenvu	__pub_jiduretcodeu<Salt state %s is disabled. To re-enable, run state.enable %sutestusaltenvubaseupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.ucachediru{0}.cache.pu
cache_nameu	highstateuallusaltutil.sync_{0}Rfu)Invalid custom module type '%s', ignoringR�RuR�R�umockR�R'u4Pillar failed to render with the following messages:uorchestration_jidi?ucacheurbNu__exclude__u
called localyu
config.optionu
state_datauuterseusls.pucmd.runuattribu-Rtpython_shelluw+bu7Unable to write to SLS cache file %s. Check permission.uDUnable to write to highstate cache file %s. Do you have permissions?(DR#RTRcR0RnRRRRRRRR�R8R�R+R$R	RvR�R�RRR�R�R@RARBR6RURtsplit_inputR5tKeyErrortwarningR�RxRtRyR(R:R�RFR�R�RGR�R�Rt
integer_typeststringutilst
to_unicodetstrR�trender_highstatetextendR<R�RR�R�R�R�RER9R"t	TypeErrorR?(ReRgRhRqt	sync_modsR&RlRrtdisabledRvR�R:R�R�R�tcfntmodule_typeR|R�R�ROthigh_R;Rt
cache_file((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR�Ms�p

	


%
 
( 


cK@sst||�}|dk	r|Stjdd�}tjjjt|�}t||�|d<|jd�}|jd�}|dkr�|dk	r�t	|t
�r�td��ny7tjj||d|dt
dtdt|��}	Wn>tk
r(tjj||d|dt
dt|��}	nXt|d	|	jd�}
|
rftjjjt
d
<dg|
S|	j�tjjj|�|	jd<i}|jd
�}d|kr�|d|	jd<nzgt||jdd��}
|	jd|jdg�d|jdd�d|jdd�d|�}Wd|	j�Xt|d|	j�t||jdd�|
�|td<|S(u�
    Execute a specific top file instead of the default. This is useful to apply
    configurations from a different environment (for example, dev or prod), without
    modifying the default top file.

    queue : False
        Instead of failing immediately when another state run is in progress,
        queue the new state run to begin running once the other has finished.

        This option starts a new thread for each queued state run, so use this
        option sparingly.

    saltenv
        Specify a salt fileserver environment to be used when applying states

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

        .. versionadded:: 2017.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' state.top reverse_top.sls
        salt '*' state.top prod_top.sls exclude=sls_to_exclude
        salt '*' state.top dev_top.sls exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
    utestupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�R�RuR�R'uretcodeu4Pillar failed to render with the following messages:u	state_topuorchestration_jidusaltenvustate_top_saltenvu	__pub_jidu
called localyRhuexcludeR�ucacheR�u
cache_nameu	highstateR�NR(RsR$R+R#RR	RvR�R�RRRR�RRxRtRyR(R:RRR�R�turltcreateR<R�R�R"R�R?(ttopfnRgRqR&RrR�R:R�R�R|R�RR�R;((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyttopds`!

	

c	K@sut||�}|dk	r|S|jd�}|jd�}|dkrt|dk	rtt|t�rttd��ntjjj	t
|�}y1tjj||d|dtdt
|��}Wn8tk
r�tjj||d|dt
|��}nXt|d|jd�}|r?tjjjtd<td	d
|��n|j�z|j�}Wd|j�Xt|�|S(u�
    Retrieve the highstate data from the salt master and display it

    Custom Pillar data can be passed with the ``pillar`` kwarg.

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_highstate
    upillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�RuR�R'uretcodeuPillar failed to renderR�N(RsR$R#RRRRR	RvR�R+R�RxRtRyR(R:RRR�RRR�tcompile_highstateR�R"(	RqR&RrR�R�R:R|R�R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_highstate�s@


cK@st||�}|dk	r|Stjjjt|�}y(tjj|dtdt	|��}Wn/t
k
r�tjj|dt	|��}nXt|d|jd�}|r�tj
jjtd<tdd|��n|j�z|j�}Wd|j�X|S(	u�
    List out the low data that will be applied to this minion

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_lowstate
    RuR�R'upillaruretcodeuPillar failed to renderR�N(RsR$RR	RvR�R+R�RxRtRyR(R:RRR�RRR�tcompile_low_chunksR�(RqR&RrR:R|R�R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
show_lowstate�s(


cK@s�t||�}|dk	r|S|jd�}|jd�}|dkrt|dk	rtt|t�rttd��ntjjt	|d|�}|j
�z|j�}Wd|j�Xt
|�|S(u�
    Retrieve the highstate data from the salt master to analyse used and unused states

    Custom Pillar data can be passed with the ``pillar`` kwarg.

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_state_usage
    upillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�N(RsR$R#RRRRRvR�R+R�tcompile_state_usageR�R"(RqR&RrR'R�R|R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_state_usages"

c	K@sst||�}|d	k	r|Stjjjt|�}y(tjj|dtdt	|��}Wn/t
k
r�tjj|dt	|��}nXt|d|jd�}|r�tj
jjtd<tdd|��n|j�t�}zj|j�}t|t�st|��nx9|D]1}t|t�sBt|�|St||d<qWWd	|j�Xt|j��S(
u�
    Returns the list of states that will be applied on highstate.

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_states

    .. versionadded:: 2019.2.0

    RuR�R'upillaruretcodeuPillar failed to renderR�u__sls__N(RsR$RR	RvR�R+R�RxRtRyR(R:RRR�RRR�RR�RRR7RR"RUR�tkeys(	RqR&RrR:R|R�R/tresultts((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_states<s8


	

cK@s�t||�}|d
k	r|Stjdd
�}tjjjt|�}t||�|d<|dd
kryd|d<n|jd�}|jd�}	|	d
kr�|d
k	r�t	|t
�r�td��ny1tjj||d|	dt
d	t|��}
Wn8tk
r9tjj||d|	d	t|��}
nXt|d
|
jd�}|rwtjjjtd<dg|Stjjj|�}|
j�z$|
ji||d6�\}
}Wd
|
j�X||
jj|
�7}|
jj|
�\}
}|r|j|�n|r)tjjjtd<|S|
jj|
�}i}xH|D]@}|jdd�|krH|j |
jj!|i|��qHqHWt"|dt#�|td<|s�tdj$|||d���n|S(ud
    Call a single ID from the named module(s) and handle all requisites

    The state ID comes *before* the module ID(s) on the command line.

    id
        ID to call

    mods
        Comma-delimited list of modules to search for given id and its requisites

    .. versionadded:: 2014.7.0

    saltenv : base
        Specify a salt fileserver environment to be used when applying states

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.sls_id my_state my_module pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override existing Pillar values set via
            ``pillar_roots`` or an external Pillar source.  Pillar values that
            are not included in the kwarg will not be overwritten.

        .. versionadded:: 2018.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' state.sls_id my_state my_module

        salt '*' state.sls_id my_state my_module,a_common_module
    utestusaltenvubaseupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�RuR�R'uretcodeu4Pillar failed to render with the following messages:Nu__id__uRu?No matches for ID '{0}' found in SLS '{1}' within saltenv '{2}'(%RsR$R+R#RR	RvR�R�RRRR�RxRtRyR(R:RRR�RRR�R�R�R�tverify_hightrequisite_inR�Rtcompile_high_dataR�t
call_chunkR"RR6(tid_ReRgRqR&RrR�R:R�R�R|R�t
split_modsR�t
req_in_errorstchunksRtchunk((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytsls_idosl.


$
&
c

K@s5d|kr|jd�nt||�}|dk	r;|Stjdd�}tjjjt|�}t	||�|d<|ddkr�d|d<n|jd�}|jd�}|dkr�|dk	r�t
|t�r�td��ny+tjj
||dtd	t|��}	Wn2tk
rItjj
||d	t|��}	nXt|d
|	jd�}
|
r�tjjjtd<tdd
|
��ntjjj|�}|	j�z$|	ji||d6�\}}
Wd|	j�X|
|	jj|�7}
|
rtjjjtd<|
S|	jj|�}|td<|S(u 
    Display the low data from a specific sls. The default environment is
    ``base``, use ``saltenv`` to specify a different environment.

    saltenv
        Specify a salt fileserver environment to be used when applying states

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. code-block:: bash

            salt '*' state.show_low_sls stuff pillar='{"foo": "bar"}'

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_low_sls foo
        salt '*' state.show_low_sls foo saltenv=dev
    uenvutestusaltenvubaseupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.RuR�R'uretcodeuPillar failed to renderR�N( RcRsR$R+R#RR	RvR�R�RRRR�RxRtRyR(R:RRR�RRRR�R�R�R�R�RR�(
ReRgRqR&RrR�R:R�R�R|R�R�R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_low_sls�sT!


$
cK@s/d|kr|jd�nt||�}|dk	r;|Stjdd�}tjjjt|�}t	||�|d<|ddkr�d|d<n|jd�}|jd�}|dkr�|dk	r�t
|t�r�td��ny1tjj
||d|d	td
t|��}	Wn8tk
rUtjj
||d|d
t|��}	nXt|d|	jd�}
|
r�tjjjtd<td
d|
��ntjjj|�}|	j�z$|	ji||d6�\}}
Wd|	j�X|
|	jj|�7}
|td<|
r+tjjjtd<|
S|S(u~
    Display the state data from a specific sls or list of sls files on the
    master. The default environment is ``base``, use ``saltenv`` to specify a
    different environment.

    This function does not support topfiles.  For ``top.sls`` please use
    ``show_top`` instead.

    Custom Pillar data can be passed with the ``pillar`` kwarg.

    saltenv
        Specify a salt fileserver environment to be used when applying states

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_sls core,edit.vim saltenv=dev
    uenvutestusaltenvubaseupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�RuR�R'uretcodeuPillar failed to renderR�N(RcRsR$R+R#RR	RvR�R�RRRR�RxRtRyR(R:RRR�RRRR�R�R�R�R�R(ReRgRqR&RrR�R:R�R�R|R�R�((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_slsAsV


$
cK@s"tt|d|d||�t�S(uT
    Tests for the existance the of a specific SLS or list of SLS files on the
    master. Similar to :py:func:`state.show_sls <salt.modules.state.show_sls>`,
    rather than returning state details, returns True or False. The default
    environment is ``base``, use ``saltenv`` to specify a different environment.

    .. versionadded:: 2019.2.0

    saltenv
        Specify a salt fileserver environment from which to look for the SLS files
        specified in the ``mods`` argument

    CLI Example:

    .. code-block:: bash

        salt '*' state.sls_exists core,edit.vim saltenv=dev
    RgRq(RR�R(ReRgRqR&((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
sls_exists�sc	K@sYtjjj|�}t|�}td�t|d|d||�D��}|j|�S(uR
    Tests for the existence of a specific ID or list of IDs within the
    specified SLS file(s). Similar to :py:func:`state.sls_exists
    <salt.modules.state.sls_exists>`, returns True or False. The default
    environment is base``, use ``saltenv`` to specify a different environment.

    .. versionadded:: 2019.2.0

    saltenv
        Specify a salt fileserver environment from which to look for the SLS files
        specified in the ``mods`` argument

    CLI Example:

    .. code-block:: bash

        salt '*' state.id_exists create_myfile,update_template filestate saltenv=dev
    cs@s|]}|dVqdS(u__id__N((Rtx((s6/usr/lib/python2.7/site-packages/salt/modules/state.pys	<genexpr>�sRgRq(RR	RR�tsetR�tissubset(tidsReRgRqR&tsls_ids((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt	id_exists�s+cK@sId|kr|jd�nt||�}|d	k	r;|Stjjjt|�}y(tjj|dt	dt
|��}Wn/tk
r�tjj|dt
|��}nXt|d|j
d�}|r�tjjjtd<tdd|��ng}|j�}||j|�7}|r6tjjjtd<|S|j|�}|S(
u�
    Return the top data that the minion will use for a highstate

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_top
    uenvRuR�R'upillaruretcodeuPillar failed to renderR�N(RcRsR$RR	RvR�R+R�RxRtRyR(R:RRR�RRtget_toptverify_topsRttop_matches(RqR&RrR:R|R�ttop_tmatches((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytshow_top�s0

"cK@s-t||�}|dk	r|S|jd�}t|�dkrWtjjjtd<dS|j	i|dd6|dd6|d	6|d
6�t
jdd�}tjj
jt
|�}t||�|d<|jd�}	|jd
�}
|
dkr|	dk	rt|	t�rtd��ny1tj
j||	d|
dtdt|��}Wn8tk
r�tj
j||	d|
dt|��}nX|j|�}|r�tjjjtd<|S|j|�t||jdd��}
i|j|�dj|�6}t|�t||jdd�|
�|t
d<|S(u�
    Execute a single state function with the named kwargs, returns False if
    insufficient data is sent to the command

    By default, the values of the kwargs will be parsed as YAML. So, you can
    specify lists values, or lists of single entry key-value maps, as you
    would in a YAML salt file. Alternatively, JSON format of keyword values
    is also supported.

    CLI Example:

    .. code-block:: bash

        salt '*' state.single pkg.installed name=vim

    u.iuretcodeuInvalid function passediustateiufunu__id__unameutestupillaru
pillar_encuNPillar data must be formatted as a dictionary, unless pillar_enc is specified.R�RuR�u	__pub_jidu
called localyu/{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}N(RsR$tsplittlenRRRRRR�R+R#R	RvR�R�RRRRwRxRtRyRzt	_mod_initR<R{R6R"R?(tfunR�RgRqR&RrtcompsR�R:R�R�R|RmR;R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytsingle�sX



cC@s�g}xxtjtd�D]c}|jd�rtjjtd|�}tjj|�s`qntj|�|j|�qqW|S(uK
    Clear out cached state files, forcing even cache runs to refresh the cache
    on the next state execution.

    Remember that the state cache is completely disabled by default, this
    execution only applies if cache=True is used in states

    CLI Example:

    .. code-block:: bash

        salt '*' state.clear_cache
    ucachediru.cache.p(	R@RQR+R�RARBR�RVRk(Rtfn_RA((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytclear_cache9s
c	K@s�tjjjt|�}tjj|�s.iStjjj	||�|ksPiSt
j�}tj
|d�}|j�}xv|D]n}	tjjj|	j�jtjdjtj�f�r�iSdjtj�tjjj|	j�kr�iSq�W|j|�|j�tjj|d�}
tjjj|
d��}tjjj|�}WdQXx!|D]}
t|
t�s\|Sq\Wtjj|d�}tjj|�r�tjjj|d��}tjjj|�}WdQXnd}tjj|d�}tjj|�r?tjjj|d��}tjjj|�}WdQXntjj|�r^||d<nd	|d
<i|d<t||�|d<tj|�}xL|D]D}tjj||�}tjj |�s�q�n|g|d|<q�Wtjj!|d
|�}t"||j#dd��}|j$|�}|j%||�}yt&j'|�Wnt(t)fk
ranXt*|�t+||j#dd�|�|S(u'
    Execute a packaged state run, the packaged state run will exist in a
    tarball available locally. This packaged state
    can be generated using salt-ssh.

    CLI Example:

    .. code-block:: bash

        salt '*' state.pkg /tmp/salt_state.tgz 760a9353810e36f6d81416366fc426dc md5
    ur:gzu..{0}u
lowstate.jsonurNupillar.jsonuroster_grains.jsonugrainsulocalu
fileclientu
file_rootsutestR�u	__pub_jidu
called localy(,RR	RvR�R+R@RAR�t	hashutilstget_hashttempfiletmkdtempttarfiletopent
getmembersR�R�t
startswithtsepR6t
extractalltcloseRBRFRGtjsonR�RRR$R�RQtisdirRwR<R#tcall_chunkstcall_listentshutiltrmtreeR�RER"R?(tpkg_pathtpkg_sumt	hash_typeRgR&tpoptstrootts_pkgtmemberstmembert
lowstate_jsonROtlowstateR�tpillar_jsonR�troster_grains_jsont
roster_grainstenvsR�tfullR|R;R((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytpkgRsh
6*







cC@s�itd6dd6}tjjj|�}g}tdd�}t|t�sWg}nt}x\|D]T}||kr�|j	dj
|��qd|j	dj
|��|j	|�t}qdW|r�tdd|�nd	j|�|d<td
�|S(uk
    Disable state runs.

    CLI Example:

    .. code-block:: bash

        salt '*' state.disable highstate

        salt '*' state.disable highstate,test.succeed_without_changes

    .. note::
        To disable a state file from running provide the same name that would
        be passed in a state.sls call.

        salt '*' state.disable bind.config

    uresuumsgu
grains.getustate_runs_disabledu!Info: {0} state already disabled.uInfo: {0} state disabled.u
grains.setvalu
usaltutil.refresh_modules(RURR	RR�R5RRRTRkR6RB(R/RtmsgR�t_changedt_state((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytdisable�s(
	


cC@sitd6dd6}tjjj|�}tjd|�g}tdd�}t|t	�sgg}nt
}xl|D]d}tjd|�||kr�|jdj|��qt|jd	j|��|j
|�t}qtW|r�td
d|�ndj|�|d<td�|S(
uk
    Enable state function or sls run

    CLI Example:

    .. code-block:: bash

        salt '*' state.enable highstate

        salt '*' state.enable test.succeed_without_changes

    .. note::
        To enable a state file from running provide the same name that would
        be passed in a state.sls call.

        salt '*' state.disable bind.config

    uresuumsgu	states %su
grains.getustate_runs_disabledu	_state %su Info: {0} state already enabled.uInfo: {0} state enabled.u
grains.setvalu
usaltutil.refresh_modules(RURR	RR�R8R�R5RRRTRkR6RVRB(R/RRR�RR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pytenable�s,
	


cC@stdd�S(u�
    List the states which are currently disabled

    CLI Example:

    .. code-block:: bash

        salt '*' state.list_disabled
    u
grains.getustate_runs_disabled(R5(((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt
list_disabled	s
cC@s�g}tdd�}x�|D]�}x�|D]�}d|kr�|jd�d}|jd�sh|dn|}|j|�r�dj||�}|j|�q*q�q*||kr*dj|�}|j|�q*q*q*WqW|S(uU
    Return messages for disabled states
    that match state functions in funs.
    u
grains.getustate_runs_disabledu.*u.iuXThe state file "{0}" is currently disabled by "{1}", to re-enable, run state.enable {1}.uOThe state file "{0}" is currently disabled, to re-enable, run state.enable {0}.(R5R�R�R�R6Rk(tfunsRR�RvRttarget_stateRm((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR�	s&

	
		
i����uminionc
C@sXtjjj||ptdtddtdt�}xtrS|jdtdt�}|dkrhq8ntjjj|d|�r9|s�tjjj	t
d�jtjjj|d�tjj
j|d	d
|d|s�dnd���tjj�n|d
kr&|d8}tjd|�n|d
krPPqPq8tjd|d�q8q8WdS(u*
    Watch Salt's event bus and block until the given tag is matched

    .. versionadded:: 2016.3.0
    .. versionchanged:: 2019.2.0
        ``tagmatch`` can now be either a glob or regular expression.

    This is useful for utilizing Salt's event bus from shell scripts or for
    taking simple actions directly from the CLI.

    Enable debug logging to see ignored events.

    :param tagmatch: the event is written to stdout for each tag that matches
        this glob or regular expression.
    :param count: this number is decremented for each event that matches the
        ``tagmatch`` parameter; pass ``-1`` to listen forever.
    :param quiet: do not print to stdout; just block
    :param sock_dir: path to the Salt master's event socket file.
    :param pretty: Output the JSON all on a single line if ``False`` (useful
        for shell tools); pretty-print the JSON output if ``True``.
    :param node: Watch the minion-side or master-side event bus.

    CLI Example:

    .. code-block:: bash

        salt-call --local state.event pretty=True
    usock_diru	transportR:tlistenRtauto_reconnectutagu{0}	{1}udatat	sort_keystindentiiiuRemaining event matches: %suSkipping event tag: %sN(RR	teventt	get_eventR+RUR$R�t
expr_matcht	print_cliR�R6tto_strRR^tsyststdouttflushR8R�(ttagmatchtcounttquiettsock_dirtprettytnodetseventR((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyR$6	s6"

		

(at__doc__t
__future__RRRtloggingR@RR)R�R�R-tsalt.configRtsalt.payloadt
salt.statetsalt.utils.argstsalt.utils.datatsalt.utils.eventtsalt.utils.filestsalt.utils.functoolstsalt.utils.hashutilstsalt.utils.jidtsalt.utils.jsontsalt.utils.platformtsalt.utils.statetsalt.utils.stringutilstsalt.utils.urltsalt.utils.versionstsalt.defaults.exitcodestsalt.exceptionsRRtsalt.runners.stateRRtsalt.utils.odictRtsalt.extRRHt__proxyenabled__t
__outputter__t__func_alias__t	getLoggert__name__R8RRRR$R"R(R0R<R?RPR\R_RbRdRTRnR,RsRtR}R�R�R�R�R�R�R�R�R�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRR�R$(((s6/usr/lib/python2.7/site-packages/salt/modules/state.pyt<module>s�	

						$"##			 /4�+*��[4%$3w[W)F	I	3	5	
	#

Zerion Mini Shell 1.0