Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/collector/clusters/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/collector/clusters/__pycache__/saltstack.cpython-36.pyc

3

�fp�@s4ddlZddlmZddlmZGdd�de�ZdS)�N)�quote)�Clusterc	@sreZdZdZdZd#ZdgZdZd$d%d&d'd(d)d*gZdZ	dZ
eed�dd�Z
eed�dd�Zed�dd�Zd d!�Zd"S)+�	saltstackzh
    The saltstack cluster profile is intended to be used on saltstack
    clusters (Salt Project).
    Z	Saltstack�salt-masterZ
saltmasterT�compound��+Filter node list to those matching compound�glob�/Filter node list to those matching glob pattern�grain�-Filter node list to those with matching grain�minion_id_unresolvableF�\Returns the FQDN grain of each minion in the node list when the minion ID is not a hostname.�	nodegroup�,Filter node list to those matching nodegroup�pillar�.Filter node list to those with matching pillar�subnet�#Filter node list to those in subnetz#salt-run --out=pprint manage.status)�output�returncCs:g}tj|jdd��}x|j�D]\}}|j|�q W|S)N�'�")�json�loads�replace�items�extend)�selfrZnodesZsalt_json_output�_�value�r!�/usr/lib/python3.6/saltstack.py�_parse_manage_status(s
zsaltstack._parse_manage_status)�
manage_statusrcCsvg}xl|j�D]`\}}|dkr<|jd|�d��|j|�qx0|D](}d|�d�}|j|j|�dj��qBWqW|S)NZdownzNode(s) z are status down.zsalt --out=newline_values_only z grains.get fqdnr)rZlog_warnr�append�exec_primary_cmd�strip)rr$Z	hostnames�statusZminionsZminion�node_cmdr!r!r"�_get_hostnames_from_grain/s
z#saltstack._get_hostnames_from_grain)rcCsX|j|j�}|ddkr td��|jd�rJtj|djdd��}|j|�S|j|d�S)Nr(rz-Node enumeration did not return usable outputr
rrr)	r&r)�	Exception�
get_optionrrrr*r#)r�resr(r!r!r"�
_get_nodes@s

zsaltstack._get_nodescCsZxP|jD]F}|ddkr|j|d�}|r|jdt|��d|d��7_PqW|j�S)Nrr
z tgt=z
 tgt_type=)�option_listr,r)rr.)rZoption�optr!r!r"�	get_nodesIs"zsaltstack.get_nodesN)r)rrr)r	rr
)rrr)r
Fr)rrr)rrr)rrr)�__name__�
__module__�__qualname__�__doc__Zcluster_nameZpackagesZsos_pluginsZstrict_node_listr/Ztargetedr)�str�listr#�dictr*r.r1r!r!r!r"rs$	r)rZshlexrZsos.collector.clustersrrr!r!r!r"�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists