o
    O6ufi  ã                   @   s&   d dl mZmZ G dd„ deeƒZdS )é    )ÚPluginÚRedHatPluginc                   @   s4   e Zd ZdZdZdZdZdZdZdZ	dZ
dd	„ Zd
S )ÚEtcdaý  The etcd plugin collects information from the etcd key-value store. It
    is primarily used by Kubernetes/OpenShift clusters and is often run inside
    a container within the cluster.

    Collections will default to executing within an `etcdctl` container, if one
    is present, and only execute on the host if such a container is not
    currently running. The `etcdctl` name preference is adopted from OpenShift
    Container Platform deployments.

    This plugin is written for etcd v3 and later.
    zetcd pluginÚetcd)r   )Ú	containerÚsystemÚservicesÚcluster)ú/etc/etcd/etcd.conf)Úetcdctlr   c                 C   s~   d }| j D ]}|  |¡r|} nq|  ddi¡ |  ddg¡ | jd|d� | jd|d� g d¢}| jd	d
„ |D ƒ|d� d S )Nr
   Ú	etcd_confz/etc/etcd/caz/etc/etcd/*.keyzls -lR /var/lib/etcd/)r   z	/etc/etcd)Úversionzmember listz
alarm listzendpoint statuszendpoint healthc                 S   s   g | ]}d |› �‘qS )zetcdctl © )Ú.0Úsubr   r   ú9/usr/lib/python3/dist-packages/sos/report/plugins/etcd.pyÚ
<listcomp>B   s    zEtcd.setup.<locals>.<listcomp>)Ú
containersÚget_container_by_nameÚadd_file_tagsÚadd_forbidden_pathÚadd_cmd_outputÚadd_copy_spec)ÚselfÚetcd_conÚconÚsubcmdsr   r   r   Úsetup%   s(   

þÿþ
þz
Etcd.setupN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
short_descÚplugin_nameÚpackagesÚprofilesÚfilesr   r   r   r   r   r   r   r      s    r   N)Úsos.report.pluginsr   r   r   r   r   r   r   Ú<module>   s   