o id@s*ddlmZmZmZGdddeeZdS))Plugin RedHatPlugin PluginOptc@sLeZdZdZdZdZdZdZdZe ddd d gZ d d Z d dZ ddZ 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 managerdnf)systempackagemanagersysmgmt)/etc/dnf/dnf.conf)r history-infoFz$collect detailed transaction history)defaultdesccCsH|sdS|D]}d|vr!|d}|dkr!|jd|ddqdS)Nz[i]rzHint:zdnf module info dnf_module_infotags) splitlinessplitadd_cmd_output)selfmoduleslinemoduler8/usr/lib/python3/dist-packages/sos/report/plugins/dnf.pyget_modules_info(s   zDNFPlugin.get_modules_infoc Cs|ddi|gd|jdgdd|dr"|dn|d |d |d |jd d d|gd|jdddgd|jdddgd|d|ddg|gd|dsq|jdddnD|jddd}d}|dr|dD]}zt|dd }Wn t yYqwt d t |d d!D] }|jd"|dd#d$qd%}||}| |ddS)&Nz/etc/dnf/modules.d/.*.module dnf_modules)z /etc/dnf/z /etc/yum.confz/etc/yum/pluginconf.d/z/etc/yum/vars/z/etc/yum.repos.d/) yum_repos_d dnf_repos_ddnf_reporall_logsz/var/log/dnf.*z/var/log/dnf.log*z/var/log/dnf.librepo.log*z/var/log/dnf.rpm.log*zdnf module listdnf_module_list)z dnf --versionzdnf list extraszpackage-cleanup --dupeszpackage-cleanup --problemszdnf list installedyum_list_installeddnf_list_installedzdnf -C repolist yum_repolist dnf_repolistzdnf -C repolist --verbosez/etc/pki/entitlement/key.pemz/etc/pki/entitlement/*-key.pem)z/etc/pki/product/*.pemz/etc/pki/consumer/cert.pemz/etc/pki/entitlement/*.pemr z dnf history dnf_historyoutput|r2zdnf history info %ddnf_history_info)subdirrzdnf module list --installed) add_file_tags add_copy_spec get_optionradd_forbidden_pathcollect_cmd_outputrintrstrip ValueErrorrangeminr)rhistory transactionsrtr_id module_cmdrrrrsetup4sd          zDNFPlugin.setupcCs2d}d}dD] }||||q|d||dS)Nz(password(\s)*=(\s)*)(\S+)\nz \1********\n)z/etc/yum.repos.d/*z/etc/dnf/vars/*r )do_path_regex_sub do_file_sub)rregexpreplfrrrpostproc~s   zDNFPlugin.postprocN)__name__ __module__ __qualname____doc__ short_desc plugin_nameprofilesfilespackagesr option_listrr;rArrrrrs  JrN)sos.report.pluginsrrrrrrrrs