o
    O6ufR  ã                   @   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¡ƒ› d�7  _ |  | j ¡}|d dkrag }dd„ |  d	¡ d
¡D ƒ}|d  ¡ dd … D ]}| ¡ }|sQ| |d ¡ qA|d |v r^| |d ¡ qA|S tdƒ‚)Nz
 get nodesr   z -l ú Ú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)Úshlexr   Úsos.collector.clustersr   r   r   r   r   r   Ú<module>   s   
