o
    i©¹dT  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )Úquote)ÚClusterc                   @   s:   e Zd ZdZdZdZd gZddiZdZddgZ	d	d
„ Z
dS )Ú
kuberneteszû
    The kuberentes cluster profile is intended to be used on kubernetes
    clusters built from the upstream/source kubernetes (k8s) project. It is
    not intended for use with other projects or platforms that are built ontop
    of kubernetes.
    zCommunity Kubernetes)zkubernetes-masterzkubernetes.allÚonÚkubectl)ÚlabelÚ z-Filter node list to those with matching label)Úroler   z,Filter node list to those with matching rolec                 C   sÆ   |  j d7  _ |  d¡r|  j dt|  d¡ƒ 7  _ |  | j ¡}|d dkr_g }dd„ |  d¡ d	¡D ƒ}|d
  ¡ dd … D ]}| ¡ }|sO| |d ¡ q?|d |v r\| |d ¡ q?|S tdƒ‚)Nz
 get nodesr   z -l %s Ústatusr   c                 S   s   g | ]}|r|‘qS © r   )Ú.0Úxr   r   úC/usr/lib/python3/dist-packages/sos/collector/clusters/kubernetes.pyÚ
<listcomp>)   s    z(kubernetes.get_nodes.<locals>.<listcomp>r	   ú,Úoutputé   é   z-Node enumeration did not return usable output)ÚcmdÚ
get_optionr   Úexec_primary_cmdÚsplitÚ
splitlinesÚappendÚ	Exception)ÚselfÚresÚnodesÚrolesÚnodelnÚnoder   r   r   Ú	get_nodes"   s    
€zkubernetes.get_nodesN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úcluster_nameÚpackagesÚsos_pluginsÚsos_plugin_optionsr   Úoption_listr!   r   r   r   r   r      s    þr   N)Úpipesr   Úsos.collector.clustersr   r   r   r   r   r   Ú<module>   s   
