Current File : //usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/dnf.cpython-36.pyc
3

\��h
�@s*ddlmZmZmZGdd�dee�ZdS)�)�Plugin�RedHatPlugin�	PluginOptc@sLeZdZdZdZdZdZdZdZe	dd	d
d�gZ
dd
�Zdd�Zdd�Z
dS)�	DNFPlugina�
    The DNF plugin collects information for the dnf package manager and how it
    is configured for local system.

    By default, this plugin will collect configuration files from /etc/dnf,
    repo files defined in /etc/yum.repos.d/, module information, and various
    'dnf list' commands.

    When using the 'history-info' option, detailed transaction information will
    be collected for the most recent 50 dnf transactions, and will be saved to
    the sos_commands/dnf/history-info directory.
    zdnf package manager�dnf�system�packagemanager�sysmgmt�/etc/dnf/dnf.confzhistory-infoFz$collect detailed transaction history)�defaultZdesccCsL|sdSx>|j�D]2}d|kr|j�d}|dkr|jd|dd�qWdS)z Get DN module information Nz[i]rzHint:zdnf module info Zdnf_module_info)�tags)�
splitlines�split�add_cmd_output)�self�modules�line�module�r�/usr/lib/python3.6/dnf.py�get_modules_info(s
zDNFPlugin.get_modules_infocCs�|jddi�|jddddg�|jddd	d
gd�|jd�rJ|jd
�n|jd�|jd�|jd�|jddd�|jddddddg�|jdddgd�|jdddgd�|jd�|jd d!g�|jd"d#d$g�|jd%�s�|jd&d'd�n�|jd&d'd�}d1}|d)�rZxJ|d)j�D]:}yt|jd*�d+j	��}PWnt
k
�rRYnX�qWx4td(t|d(d,��D]}|jd-|��d%d.d/��qpWd0}|j|�}|j
|d)�dS)2Nz/etc/dnf/modules.d/.*.moduleZdnf_modulesz	/etc/dnf/z
/etc/yum.confz/etc/yum/pluginconf.d/z/etc/yum/vars/z/etc/yum.repos.d/Zyum_repos_dZdnf_repos_dZdnf_repo)rZall_logsz/var/log/dnf.*z/var/log/dnf.log*z/var/log/dnf.librepo.log*z/var/log/dnf.rpm.log*zdnf module listZdnf_module_listz
dnf --versionzdnf list extraszdnf updateinfo info securityzdnf updateinfo list --availablezpackage-cleanup --dupeszpackage-cleanup --problemszdnf list installedZyum_list_installedZdnf_list_installedzdnf -C repolistZyum_repolistZdnf_repolistzdnf -C repolist --verbosez/etc/pki/entitlement/key.pemz/etc/pki/entitlement/*-key.pemz/etc/pki/product/*.pemz/etc/pki/consumer/cert.pemz/etc/pki/entitlement/*.pemzhistory-infozdnf historyZdnf_history��output�|r�2zdnf history info Zdnf_history_info)Zsubdirrzdnf module list --installed���)Z
add_file_tagsZ
add_copy_specZ
get_optionrZadd_forbidden_pathZcollect_cmd_outputr
�intr�strip�
ValueError�range�minr)r�historyZtransactionsrZtr_idZ
module_cmdrrrr�setup5sl








zDNFPlugin.setupcCsDd}d}xdD]}|j|||�qW|jd||�|jddg�dS)Nz(password(\s)*=(\s)*)(\S+)\nz\1********\n�/etc/yum.repos.d/*�/etc/dnf/vars/*z/etc/dnf/dnf.confz/var/log/dnf.*)r#r$)Zdo_path_regex_subZdo_file_subZdo_paths_http_sub)rZregexp�repl�filerrr�postproc�s	
zDNFPlugin.postprocN)rrr	)r
)r)�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZprofiles�filesZpackagesrZoption_listrr"r'rrrrrs

MrN)Zsos.report.pluginsrrrrrrrr�<module>s