o
    O6ufb  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    ©Úquote)ÚClusterc                   @   s0   e Zd ZdZdZdZdd„ Zdd„ Zdd	„ Zd
S )Ú	satellitea3  
    This profile is specifically for Red Hat Satellite 6, and not earlier
    releases of Satellite.

    While note technically a 'cluster' in the traditional sense, Satellite
    does provide for 'capsule' nodes which is what this profile aims to
    enumerate beyond the 'primary' Satellite system.
    zRed Hat Satellite 6)r   zsatellite-installerc                 C   s   d}d}|t |t |ƒ ƒ S )Nzsu postgres -c %szpsql foreman -c %sr   )ÚselfÚqueryÚ_cmdÚ_dbcmd© r
   úB/usr/lib/python3/dist-packages/sos/collector/clusters/satellite.pyÚ	_psql_cmd   s   zsatellite._psql_cmdc                 C   sB   |   d¡}| j|dd�}|d dkrdd„ |d  ¡ D ƒ}|S g S )	Nz/copy (select name from smart_proxies) to stdoutT)Ú	need_rootÚstatusr   c                 S   s   g | ]
}d |vr|  ¡ ‘qS )zcould not change directory)Ústrip)Ú.0Únr
   r
   r   Ú
<listcomp>%   s
    ÿz'satellite.get_nodes.<locals>.<listcomp>Úoutput)r   Úexec_primary_cmdÚ
splitlines)r   ÚcmdÚresÚnodesr
   r
   r   Ú	get_nodes!   s   

ÿzsatellite.get_nodesc                 C   s   |j | jj kr	dS dS )Nr   Úcapsule)ÚaddressÚprimary)r   Únoder
   r
   r   Úset_node_label,   s   zsatellite.set_node_labelN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úcluster_nameÚpackagesr   r   r   r
   r
   r
   r   r      s    	r   N)Úshlexr   Úsos.collector.clustersr   r   r
   r
   r
   r   Ú<module>   s   
