HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 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/tops/__pycache__/ext_nodes.cpython-310.pyc
o

�N�g�
�@sjdZddlZddlZddlZddlZddlZejj�	�r#ddl
mZnej
Ze�e�Zdd�Zdd�ZdS)a�
External Nodes Classifier
=========================

The External Nodes Classifier is a master tops subsystem that retrieves mapping
information from major configuration management systems. One of the most common
external nodes classifiers system is provided by Cobbler and is called
``cobbler-ext-nodes``.

The cobbler-ext-nodes command can be used with this configuration:

.. code-block:: yaml

    master_tops:
      ext_nodes: cobbler-ext-nodes

It is noteworthy that the Salt system does not directly ingest the data
sent from the ``cobbler-ext-nodes`` command, but converts the data into
information that is used by a Salt top file.

Any command can replace the call to 'cobbler-ext-nodes' above, but currently the
data must be formatted in the same way that the standard 'cobbler-ext-nodes'
does.

See (admittedly degenerate and probably not complete) example:

.. code-block:: yaml

    classes:
      - basepackages
      - database

The above essentially is the same as a top.sls containing the following:

.. code-block:: yaml

    base:
      '*':
        - basepackages
        - database

    base:
      '*':
        - basepackages
        - database
�N)�escape_argumentcCstd�d�r	dSdS)z)
    Only run if properly configured
    �master_tops�	ext_nodesTF)�__opts__�get�rr�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/tops/ext_nodes.py�__virtual__?sr	cKs�d|dvriStjdd�tjtddtjj��dud�t	|dd�gD�tj
d	d
�}tjj�|j
�}|s=t�d�i}d|vrH|d}nd
}d|vrpt|dt�r_t|d�||<|St|dt�rn|d||<|S|St�d�|S)z$
    Run the command configured
    �id�optscSsg|]}t|��qSr)�
_cmd_quote)�.0�partrrr�
<listcomp>Os��ztop.<locals>.<listcomp>rrF)�posixT)�stdout�checkz2master_tops ext_nodes call did not return any dataZenvironment�baseZclasseszJmaster_tops ext_nodes call did not have a dictionary with a "classes" key.)�
subprocess�run�shlex�splitr�salt�utils�platform�
is_windowsr�PIPEZyamlZ	safe_loadr�log�info�
isinstance�dict�list)�kwargs�procZndata�ret�envrrr�topHsB
����


���r&)�__doc__�loggingrrZsalt.utils.platformrZsalt.utils.yamlrrrZsalt.utils.win_functionsrr�quote�	getLogger�__name__rr	r&rrrr�<module>s/