File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/saltmod.cpython-310.pyc
o
�N�g�� � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
ZddlZddlZe�
e�ZdZdd� Zdd� Zdd � Z
ddd�Z
ddd�Zddd�Zdd� Zdd� Zdd� ZdS ) a�
Control the Salt command interface
==================================
This state is intended for use from the Salt Master. It provides access to
sending commands down to minions as well as access to executing master-side
modules. These state functions wrap Salt's :ref:`Python API <python-api>`.
.. versionadded:: 2016.11.0
Support for masterless minions was added to the ``salt.state`` function,
so they can run orchestration sls files. This is particularly useful when
the rendering of a state is dependent on the execution of another state.
Orchestration will render and execute each orchestration block
independently, while honoring requisites to ensure the states are applied
in the correct order.
.. seealso:: More Orchestrate documentation
* :ref:`Full Orchestrate Tutorial <orchestrate-runner>`
* :py:func:`The Orchestrate runner <salt.runners.state.orchestrate>`
� N�saltc C s t S )z
Named salt
)�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/saltmod.py�__virtual__+ s r c C s: z
t jj�tt| d� W d S ty t�d� Y d S w )N�run�>Unable to fire args event due to missing __orchestration_jid__) r �utils�eventZ fire_args�__opts__�__orchestration_jid__� NameError�log�debug)Ztag_datar r r �
_fire_args2 s
�r c s� t ��dg �t ��dg � � ���fdd�}tt|tt �����}|D ]}|�� q$� D ]}|dur=|\}}}|�|��q-�S )a
Applies a function to each element of a list, returning the resulting list.
A separate thread is created for each element in the input list and the
passed function is called for each of the elements. When all threads have
finished execution a list with the results corresponding to the inputs is
returned.
If one of the threads fails (because the function throws an exception),
that exception is reraised. If more than one thread fails, the exception
from the first thread (according to the index of the input element) is
reraised.
func:
function that is applied on each input element.
inputs:
list of elements that shall be processed. The length of this list also
defines the number of threads created.
Nc s, ��� ��fdd�}t j|d�}|�� |S )Nc s0 z��� ���<