File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/aliases.cpython-310.pyc
o
�N�g. � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
mZ dddddd�Ze�
d�Zdd � Zd
d� Zdd
� Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )z,
Manage the information in the aliases file
� N)�SaltInvocationError�txtZyaml)�rm_alias�
has_target�
get_target�
set_target�list_aliasesz"([^:#]*)\s*:?\s*([^#]*?)(\s+#.*|$)c C s t j�td d��S )z9
Return the path to the appropriate aliases file
z
config.optionzaliases.file)�os�path�realpath�__salt__� r
r
�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aliases.py�__get_aliases_filename s r c C s� t � } g }tj�| �s
|S tjj�| d��.}|D ]"}tjj� |�}t
�|�}|r0|�|�
� � q|�dd|�� f� qW d � |S 1 sFw Y |S )z�
Parse the aliases file, and return a list of line components:
[
(alias1, target1, comment1),
(alias2, target2, comment2),
]
�rN)r r r
�isfile�salt�utils�filesZfopenZstringutilsZ
to_unicode�
__ALIAS_RE�match�append�groups�strip)�afn�retZifile�liner r
r
r �__parse_aliases"