U
    -_g*                     @   s2   d dl Z d dlmZmZmZ G dd deeZdS )    N)PluginIndependentPlugin	PluginOptc                   @   sT   e Zd ZdZdZdZdZed ed gZefZe	dde
d	d
gZdd Zdd ZdS )ContainerLogz"All logs under /var/log/containersZcontainer_logz/var/log/containers/z/var/log/pods/z	*/*.log.*z*/*/*.log.*rotatedFz(also get rotated logs from /var/log/pods)defaultZval_typeZdescc                 C   sX   |  dr.| | j |  drT| | j n&| | jd |  drT| | jd d S )NZall_logsr   z*.logz*.log.*)Z
get_optionadd_copy_speclogdirrotated_dirscollect_subdirspoddir)self r   B/usr/lib/python3/dist-packages/sos/report/plugins/container_log.pysetup   s    


zContainerLog.setupc                 C   s,   t |D ]\}}}| | || q
dS )z=Collect *.log files from subdirs of passed root path
        N)oswalkr   Z	path_join)r   rootglobZdir_name_r   r   r   r   '   s    zContainerLog.collect_subdirsN)__name__
__module____qualname__Z
short_descZplugin_namer	   r   r
   filesr   boolZoption_listr   r   r   r   r   r   r      s   
r   )r   Zsos.report.pluginsr   r   r   r   r   r   r   r   <module>   s   