o
    O6uf>  ã                   @   sL   d dl mZmZmZmZmZmZ G dd„ deeeeƒZG dd„ deeƒZdS )é    )ÚPluginÚRedHatPluginÚDebianPluginÚUbuntuPluginÚ	CosPluginÚ	PluginOptc                   @   sT   e Zd ZdZdZdZdZedddd�ed	dd
d�edddd�gZdd„ Z	dd„ Z
dS )ÚFilesysaä  Collects general information about the local filesystem(s) and mount
    points as well as optional information about EXT filesystems. Note that
    information specific filesystems such as XFS or ZFS is not collected by
    this plugin, as there are specific plugins for those filesystem types.

    This plugin will collect /etc/fstab as well as mount information within
    /proc/, and is responsible for the 'mount' and 'df' symlinks that appear
    in an sos archive's root.
    zLocal file systemsÚfilesys)ÚstorageÚlsofFz%collect information on all open files)ÚdefaultÚdescÚdumpe2fszdump filesystem infoÚfragz'collect filesystem fragmentation statusc                 C   sÌ   |   g d¢¡ | jdddd� | jdddd� |  g d¢¡ |  g d	¢¡ |  d
¡r2| jdd
dd� d}|  d¡r;d}d}d}|  ||¡D ]}| jd|› d|› �dd� |  d¡rc| jd|› �dd� qEd S )N)
z	/proc/fs/ú/proc/mountsz/proc/filesystemsz/proc/self/mountsz/proc/self/mountinfoz/proc/self/mountstatsz/proc/[0-9]*/mountinfoz	/etc/mtabú
/etc/fstabz/run/mount/utabzmount -lÚmount)Úroot_symlinkÚtagszdf -al -x autofsÚdfÚdf__al)zdf -aliT -x autofsÚfindmntÚlslocks)z/proc/fs/cifsz/proc/fs/ldiskfsz/proc/fs/lustrez/proc/fs/nfsdz/proc/fs/nfsfsz/proc/fs/panfsz/proc/fs/xfsr   zlsof -b +M -n -l -Pé2   )r   Úpriorityz-hr   Ú r   z^(/dev/\S+).+ext[234]\s+z	dumpe2fs ú Ú
dumpe2fs_h)r   r   ze2freefrag éd   )r   )Úadd_copy_specÚadd_cmd_outputÚadd_forbidden_pathÚ
get_optionÚdo_regex_find_all)ÚselfÚdumpe2fs_optsÚmountsÚext_fs_regexÚdev© r)   ú</usr/lib/python3/dist-packages/sos/report/plugins/filesys.pyÚsetup%   s4   ÿÿ
ÿ
ÿ
€ûzFilesys.setupc                 C   s$   |   ddd¡ d}|  d|d¡ d S )Nr   z(password=)[^,\s]*z
\1********z](lsof: (avoiding (.*?)|WARNING: can't stat\(\) (.*?))|Output information may be incomplete.)
r   r   )Údo_file_subÚdo_cmd_output_sub)r$   Úregexr)   r)   r*   Úpostproc\   s   ýzFilesys.postprocN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
short_descÚplugin_nameÚprofilesr   Úoption_listr+   r/   r)   r)   r)   r*   r      s    
ÿÿü7r   c                       s   e Zd Z‡ fdd„Z‡  ZS )ÚRedHatFilesysc                    s   t ƒ  ¡  |  d¡ d S )Nzls -ltradZ /tmp)Úsuperr+   r    )r$   ©Ú	__class__r)   r*   r+   m   s   
zRedHatFilesys.setup)r0   r1   r2   r+   Ú__classcell__r)   r)   r:   r*   r8   k   s    r8   N)	Úsos.report.pluginsr   r   r   r   r   r   r   r8   r)   r)   r)   r*   Ú<module>   s    ^