3 ܓi @s*ddlmZmZmZGdddeeZdS))Plugin RedHatPlugin PluginOptc@sLeZdZdZdZdZdZdZdZe dd d d gZ d d Z ddZ 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 managerdnfsystempackagemanagersysmgmt/etc/dnf/dnf.confz history-infoFz$collect detailed transaction history)defaultZdesccCsL|sdSx>|jD]2}d|kr|jd}|dkr|jd|ddqWdS)z Get DN module information Nz[i]rzHint:zdnf module info Zdnf_module_info)tags) splitlinessplitadd_cmd_output)selfmoduleslinemoduler/usr/lib/python3.6/dnf.pyget_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)jD]:}yt|jd*d+j }PWnt k rRYnXqWx4t d(t |d(d,D]}|jd-|d%d.d/qpWd0}|j|}|j |d)dS)2Nz/etc/dnf/modules.d/.*.moduleZ dnf_modulesz /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_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-infoz 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_cmdrrrrsetup5sl              zDNFPlugin.setupcCsDd}d}xdD]}|j|||qW|jd|||jddgdS)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_subZ do_file_subZdo_paths_http_sub)rZregexpreplfilerrrpostprocs   zDNFPlugin.postprocN)rrr )r )r)__name__ __module__ __qualname____doc__Z short_descZ plugin_nameZprofilesfilesZpackagesrZ option_listrr"r'rrrrrs   MrN)Zsos.report.pluginsrrrrrrrr s