U
    -_g                     @   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servicesZcluster)/etc/etcd/etcd.conf)Zetcdctlr   c                 C   s   d }| j D ]}| |r
|} q"q
| ddi | ddg | jd|dd | jd|d	 d
ddddg}| jdd |D |d	 d S )Nr	   Z	etcd_confz/etc/etcd/caz/etc/etcd/*.keyz/var/lib/etcd/T)r   	recursivez	/etc/etcd)r   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>C   s     zEtcd.setup.<locals>.<listcomp>)
containersZget_container_by_nameZadd_file_tagsZadd_forbidden_pathZadd_dir_listingZadd_copy_specZadd_cmd_output)selfZetcd_conZconZsubcmdsr   r   r   setup%   s6    

 z
Etcd.setupN)__name__
__module____qualname____doc__Z
short_descZplugin_nameZpackagesZprofilesfilesr   r   r   r   r   r   r   r      s   r   N)Zsos.report.pluginsr   r   r   r   r   r   r   <module>   s   