File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/survey.cpython-310.pyc
o
�N�g[ � @ s4 d Z ddlZddlmZ dd� Zdd� Zdd � ZdS )
a
A general map/reduce style salt runner for aggregating results
returned by several different minions.
.. versionadded:: 2014.7.0
Aggregated results are sorted by the size of the minion pools which returned
matching results.
Useful for playing the game: *"some of these things are not like the others..."*
when identifying discrepancies in a large infrastructure managed by salt.
� N)�SaltClientErrorc O s t | i |��S )a�
Return the MATCHING minion pools from the aggregated and sorted results of
a salt command
.. versionadded:: 2014.7.0
This command is submitted via a salt runner using the
general form::
salt-run survey.hash [survey_sort=up/down] <target>
<salt-execution-module> <salt-execution-module parameters>
Optionally accept a ``survey_sort=`` parameter. Default: ``survey_sort=down``
CLI Example #1: (functionally equivalent to ``salt-run manage.up``)
.. code-block:: bash
salt-run survey.hash "*" test.ping
CLI Example #2: (find an "outlier" minion config file)
.. code-block:: bash
salt-run survey.hash "*" file.get_hash /etc/salt/minion survey_sort=up
)�_get_pool_results)�args�kwargs� r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/survey.py�hash s r c O s^ ddl }t| i |��}d}|D ]�}td� t|d � td� tdtt|d �� � |rAd}td � td|d d
� t� qd�|d d d �}t|� tdt|�d
� |d d
�� }t|�D ]\}} || d7 <