a >h @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)systemZpackagemanagerZsysmgmt)/etc/dnf/dnf.conf)r history-infoFz$collect detailed transaction history)defaultZdesccCsH|sdS|D]2}d|vr|d}|dkr|jd|ddqdS)z Get DN module information Nz[i]rzHint:zdnf module info Zdnf_module_infotags) splitlinessplitadd_cmd_output)selfmoduleslinemoduler:/usr/lib/python3.9/site-packages/sos/report/plugins/dnf.pyget_modules_info(s   zDNFPlugin.get_modules_infoc Cs|ddi|gd|jdgdd|drD|dn|d |d |d |jd d d|gd|jdddgd|jdddgd|d|ddg|gd|ds|jdddn|jddd}d}|drJ|dD]>}z"t|dd }WqJWnt yDYn0q t d t |d d!D]}|jd"|dd#d$q^d%}||}| |ddS)&Nz/etc/dnf/modules.d/.*.moduleZ dnf_modules)z /etc/dnf/z /etc/yum.confz/etc/yum/pluginconf.d/z/etc/yum/vars/z/etc/yum.repos.d/)Z yum_repos_dZ dnf_repos_dZdnf_repor Zall_logs/var/log/dnf.*z/var/log/dnf.log*z/var/log/dnf.librepo.log*z/var/log/dnf.rpm.log*zdnf module listZdnf_module_list)z 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.pem)z/etc/pki/product/*.pemz/etc/pki/consumer/cert.pemz/etc/pki/entitlement/*.pemr z dnf historyZ dnf_historyoutput|r2zdnf history info Zdnf_history_info)Zsubdirr zdnf module list --installed)Z add_file_tagsZ add_copy_specZ get_optionrZadd_forbidden_pathZcollect_cmd_outputr intrstrip ValueErrorrangeminr)rhistoryZ transactionsrZtr_idZ module_cmdrrrrsetup5sb              zDNFPlugin.setupcCs@d}d}dD]}||||q |d|||ddgdS)Nz(password(\s)*=(\s)*)(\S+)\nz \1********\n)/etc/yum.repos.d/*z/etc/dnf/vars/*rr$r)Zdo_path_regex_subZ do_file_subZdo_paths_http_sub)rZregexpreplfilerrrpostprocs  zDNFPlugin.postprocN)__name__ __module__ __qualname____doc__Z short_descZ plugin_nameZprofilesfilesZpackagesrZ option_listrr#r'rrrrrs  MrN)Zsos.report.pluginsrrrrrrrr s