File manager - Edit - /usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__/saltstack.cpython-310.pyc
Back
o -�_gp � @ s4 d dl Z d dlmZ d dlmZ G dd� de�ZdS )� N)�quote)�Clusterc @ sl e Zd ZdZdZdZdgZdZg d�ZdZ dZ d ed efdd�Z d ed efdd�Zd efdd�Zdd� ZdS )� saltstackzh The saltstack cluster profile is intended to be used on saltstack clusters (Salt Project). � Saltstack)zsalt-master� saltmasterT))�compound� z+Filter node list to those matching compound)�globr z/Filter node list to those matching glob pattern)�grainr z-Filter node list to those with matching grain)�minion_id_unresolvableFz\Returns the FQDN grain of each minion in the node list when the minion ID is not a hostname.)� nodegroupr z,Filter node list to those matching nodegroup)�pillarr z.Filter node list to those with matching pillar)�subnetr z#Filter node list to those in subnetFz#salt-run --out=pprint manage.status�output�returnc C s6 g }t �|�dd��}|�� D ] \}}|�|� q|S )N�'�")�json�loads�replace�items�extend)�selfr �nodes�salt_json_output�_�value� r �B/usr/lib/python3/dist-packages/sos/collector/clusters/saltstack.py�_parse_manage_status( s zsaltstack._parse_manage_status� manage_statusc C sn g }|� � D ].\}}|dkr| �d|� d�� |�|� q|D ]}d|� d�}|�| �|�d �� � qq|S )N�downzNode(s) z are status down.zsalt --out=newline_values_only z grains.get fqdnr )r �log_warnr �append�exec_primary_cmd�strip)r r � hostnames�status�minions�minion�node_cmdr r r �_get_hostnames_from_grain/ s ���z#saltstack._get_hostnames_from_grainc C sX | � | j�}|d dkrtd��| �d�r%t�|d �dd��}| �|�S | �|d �S )Nr'