File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/roster/__pycache__/__init__.cpython-310.pyc
o
�N�g�
� @ sH d Z ddlZddlZddlZddlZe�e�Zdd� Z G dd� 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.
� Nc C s d}| � d�r-| � d�r-| � d��d�}| � d�D ]}tj�||�}tj�|�r,|} nq|se| � d�r:| � d�}n+d| � di �v rNtj�| d d d�}nd| v r\tj�| d d�}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�templater Zroster_locationZr_file� r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/roster/__init__.py�get_roster_file s, �
r c @ s* e Zd ZdZd
dd�Zdd� Zdd� Zd S )�Rosterze
Used to manage a roster of minions allowing the master to become outwardly
minion aware
�flatc C s| || _ t|t�r|| _nt|t�r|�d�| _n|| _|s!dg| _tj�| j �}tjj | j |d�}tjj
| j ||d�| _d S )N�,r )�utils)�runnerr )�opts�
isinstance�list�backends�str�splitr �loaderr r r r )�selfr r r r r r r �__init__>