HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/state.cpython-310.pyc
o

�N�g�$�@sdZddlZddlZddlZddlZddlZddlmZe�	e
�Zddd�Zej
j�ed�Zddd�Zej
j�ed	�Zdd
d�Z							d d
d�Zej
j�ed�Zej
j�ed�Zd!dd�Zd!dd�Z						d"dd�Zej
j�ed�Z	d#dd�ZdS)$z!
Execute orchestration functions
�N)�SaltInvocationErrorcCs"tj�t�}|jd|||�dS)z�
    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.
    zstate.pauseN��salt�minion�MasterMinion�__opts__�	functions)�jid�state_idZdurationr�r�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/state.py�pausesr
�	set_pausecC� tj�t�}|jd||�dS)z<
    Remove a pause from a jid, allowing it to continue
    zstate.resumeNr�r	r
rrrr�resumesr�rm_pausecCr)aA
    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.
    zstate.soft_killNrrrrr�	soft_kill(sr�basec
Csztd}ttd<t�d|t�Wntyt�d�Ynw|dur-t|t�s-td��dtd<tj	�
t�}	|durCdtvrCtd}|durOd	tvrOtd	}|durZtjj�
t�}|	jd
|||||||||d�	}
|	jd|
id
d�}td|d�}|r�d|d<|Sd|d<|S)a~
    .. versionadded:: 0.17.0

    Execute a state run from the master, used as a powerful orchestration
    system.

    .. seealso:: More Orchestrate documentation

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

    CLI Examples:

    .. code-block:: bash

        salt-run state.orchestrate webserver
        salt-run state.orchestrate webserver saltenv=dev test=True
        salt-run state.orchestrate webserver saltenv=dev pillarenv=aws

    .. versionchanged:: 2014.1.1

        Runner renamed from ``state.sls`` to ``state.orchestrate``

    .. versionchanged:: 2014.7.0

        Runner uses the pillar variable

    .. versionchanged:: 2017.5.0

        Runner uses the pillar_enc variable that allows renderers to render the pillar.
        This is usable when supplying the contents of a file as pillar, and the file contains
        gpg-encrypted entries.

    .. seealso:: GPG renderer documentation

    CLI Examples:

    .. code-block:: bash

       salt-run state.orchestrate webserver pillar_enc=gpg pillar="$(cat somefile.json)"

    �userz8changed opts user from original '%s' to global user '%s'z#unable to find global user __user__N�-Pillar data must be formatted as a dictionary�local�file_client�	pillarenv�saltenvz	state.sls)�pillarrr�
pillar_encZ	__pub_jid�orchestration_jid�id�	highstate��dataZ	outputterzstate.check_resultr!r�retcode�)rZ__user__�log�debug�	NameError�
isinstance�dictrrrr�utilsr	Zgen_jidr�optsZ	__utils__)
�modsr�testZexcluderrrrZ	orig_userr�running�ret�resrrr�orchestrate4sN5����r0�orch�slsFc	Ksz|durt|t�r||d<ntd��dtd<tj�t�}|jd||fddd�|��}|jd	|i}t	�
|d
d�d�|S)
z�
    Execute a single state orchestration routine

    .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt-run state.orchestrate_single fun=salt.wheel name=key.list_all
    Nrrrrzstate.singleF)r,�queuerrr �progress�r'r(rrrrrrr*Z
__jid_event__Z
fire_event)	Zfun�namer,r3r�kwargsrr-r.rrr�orchestrate_single�s 

���r8cKsp|dur
t|t�s
td��dtd<tj�t�}|jd|fdd|d�|��}|jd|i}t	�
|d	d
�d�|S)a�
    Execute a single state orchestration routine

    .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt-run state.orchestrate_high '{
            stage_one:
                {salt.state: [{tgt: "db*"}, {sls: postgres_setup}]},
            stage_two:
                {salt.state: [{tgt: "web*"}, {sls: apache_setup}, {
                    require: [{salt: stage_one}],
                }]},
            }'
    Nrrrz
state.highF)r,r3rrrr r4r5)r!r,r3rr7rr-r.rrr�orchestrate_high�s���r9c
	Cs\|dur
t|t�s
td��dtd<tj�t�}|jd|||||||d�}|jd|i}	|	S)a�
    Display the state data from a specific sls, or list of sls files, after
    being render using the master minion.

    Note, the master minion adds a "_master" suffix to its minion id.

    .. seealso:: The state.show_sls module function

    CLI Example:

    .. code-block:: bash

        salt-run state.orch_show_sls my-orch-formula.my-orch-state 'pillar={ nodegroup: ng1 }'
    Nrrrzstate.show_sls)rrrrr)	r'r(rrrrrrr*)
r+rr,r3rrrrr-r.rrr�orchestrate_show_sls�s�
r:�
orch_show_sls�*����mastercCs(tj�tdd�}|d||||||d�S)aS
    Watch Salt's event bus and block until the given tag is matched

    .. versionadded:: 2014.7.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.
        .. versionadded:: 2016.3.0

    CLI Examples:

    .. code-block:: bash

        # Reboot a minion and run highstate when it comes back online
        salt 'jerry' system.reboot && \\
            salt-run state.event 'salt/minion/jerry/start' count=1 quiet=True && \\
            salt 'jerry' state.highstate

        # Reboot multiple minions and run highstate when all are back online
        salt -L 'kevin,stewart,dave' system.reboot && \\
            salt-run state.event 'salt/minion/*/start' count=3 quiet=True && \\
            salt -L 'kevin,stewart,dave' state.highstate

        # Watch the event bus forever in a shell while-loop.
        salt-run state.event | while read -r tag data; do
            echo $tag
            echo $data | jq --color-output .
        done

    .. seealso::

        See :blob:`tests/eventlisten.sh` for an example of usage within a shell
        script.
    �stateNzstate.event)�tagmatch�count�quiet�sock_dir�pretty�node)r�loaderZraw_modr)r@rArBrCrDrEZstatemodrrr�events3�rG)NN)N)rNNNNNN)NFN)rNFNNN)r<r=FNFr>)�__doc__�loggingZsalt.loaderrZsalt.utils.eventZsalt.utils.functoolsZsalt.utils.jidZsalt.exceptionsr�	getLogger�__name__r$r
r)�	functoolsZalias_functionrrrrr0r1r2r8r9r:r;rGrrrr�<module>sJ





�a

!
�*��