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/roster/__pycache__/__init__.cpython-310.pyc
o

�N�g�
�@sHdZddlZddlZddlZddlZe�e�Zdd�Z	Gdd�d�Z
dS)a 
Generate roster data, this data is used by non-minion devices which need to be
hit from the master rather than acting as an independent entity. This covers
hitting minions without zeromq in place via an ssh agent, and connecting to
systems that cannot or should not host a minion agent.
�NcCsd}|�d�r-|�d�r-|�d��d�}|�d�D]}tj�||�}tj�|�r,|}nq|se|�d�r:|�d�}n+d|�di�vrNtj�|ddd�}nd|vr\tj�|dd�}n	tj�tjjd�}tj�|�sst	d	|�d
���t�
|tj�s�t	d|�d���|S)
zH
    Find respective roster file.

    :param options:
    :return:
    NZ__disable_custom_rosterZroster_file�/�rostersZ
config_dirZ__master_opts__�rosterz
Roster file "z" not foundzAccess denied to roster "�")�get�strip�os�path�join�isfile�saltZsyspathsZ
CONFIG_DIR�OSError�access�R_OK)�options�templaterZroster_locationZr_file�r�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/roster/__init__.py�get_roster_files,�
rc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�Rosterze
    Used to manage a roster of minions allowing the master to become outwardly
    minion aware
    �flatcCs|||_t|t�r||_nt|t�r|�d�|_n||_|s!dg|_tj�|j�}tjj	|j|d�}tjj
|j||d�|_dS)N�,r)�utils)�runnerr)�opts�
isinstance�list�backends�str�splitr�loaderrrrr)�selfrrrrrrr�__init__>s

zRoster.__init__cCsBt�}|jr|jD]}|�d�}||jvr|�|�q	|St|�S)z9
        Return a list of loaded roster backends
        �.targets)�setrr�add�sorted)r!�backZbackendZfunrrr�	_gen_backLs



�zRoster._gen_backcCs�i}|��D]L}|�d�}||jvrqz
|�|j|||��Wqtjjy:}zt�d|�WYd}~qd}~wtyR}z
t�d||�WYd}~qd}~ww|S)z�
        Return a dict of {'id': {'ipv4': <ipaddr>}} data sets to be used as
        targets given the passed tgt and tgt_type
        r#z Unable to render roster file: %sNz&Can't access roster for backend %s: %s)	r(r�updater�
exceptionsZSaltRenderError�log�errorr
)r!ZtgtZtgt_type�targetsr'Zf_str�excrrrr-Ys

���zRoster.targetsN)r)�__name__�
__module__�__qualname__�__doc__r"r(r-rrrrr8s


r)r2�loggingrZsalt.loaderrZ
salt.syspaths�	getLoggerr/r+rrrrrr�<module>s
'