
    -_g                     0    d dl mZmZmZ  G d dee      Zy)    )PluginRedHatPlugin	PluginOptc                   N    e Zd ZdZdZdZdZdZdZ e	ddd	
      gZ
d Zd Zd Zy)	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.
    zdnf package managerdnf)systempackagemanagersysmgmt)/etc/dnf/dnf.conf)r   history-infoFz$collect detailed transaction history)defaultdescc                     |sy|j                         D ]6  }d|v s|j                         d   }|dk7  s!| j                  d|z   d       8 y)z Get DN module information Nz[i]r   zHint:zdnf module info dnf_module_infotags)
splitlinessplitadd_cmd_output)selfmoduleslinemodules       8/usr/lib/python3/dist-packages/sos/report/plugins/dnf.pyget_modules_infozDNFPlugin.get_modules_info(   sa     &&( 	@D}aW$''(:V(C-> ( @		@    c                    | j                  ddi       | j                  g d       | j                  dg d       | j                  d      r| j                  d       n3| j                  d	       | j                  d
       | j                  d       | j                  dd       | j                  g d       | j                  dddg       | j                  dddg       | j                  d       | j	                  ddg       | j                  g d       | j                  d      s| j                  dd       n| j                  dd      }d}|d   rE|d   j                         D ]/  }	 t        |j                  d      d   j                               } n t        d t        |d z   d!            D ]  }| j                  d"| dd#$        d%}| j                  |      }| j                  |d          y # t        $ r Y w xY w)&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_ddnf_repor   all_logsz/var/log/dnf.*z/var/log/dnf.log*z/var/log/dnf.librepo.log*z/var/log/dnf.rpm.log*zdnf module listdnf_module_list)zdnf --versionzdnf list extraszpackage-cleanup --dupeszpackage-cleanup --problemszdnf list installedyum_list_installeddnf_list_installedzdnf -C repolistyum_repolistdnf_repolistzdnf -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_historyoutput|r      2   zdnf history info dnf_history_info)subdirr   zdnf module list --installed)add_file_tagsadd_copy_spec
get_optionr   add_forbidden_pathcollect_cmd_outputr   intr   strip
ValueErrorrangeminr   )r   historytransactionsr   tr_id
module_cmdr   s          r   setupzDNFPlugin.setup5   sW   *M
 	 	 
 	 	. J 	 	L ??:&/023:;67-!2 	 	4 	 
 	 	0"68L!M 	 	O 	-"0.!A 	 	C 	78*,!
 	
 	 
 	 ~.MB--m3@ . BGLx #H-88: D'*4::c?1+=+C+C+E'F q#l1nb"9: =##&7w$?+9); $ == 3
))*5gh/0 & s   /+G::	HHc                 f    d}d}dD ]  }| j                  |||        | j                  d||       y )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)r   regexpreplfiles       r   postproczDNFPlugin.postproc   sD     1= 	7D""46	7 	,fd;r   N)__name__
__module____qualname____doc__
short_descplugin_nameprofilesfilespackagesr   option_listr   r?   rF    r   r   r   r      sL     'JK6H"EH 	.%=	?K
@I1V<r   r   N)sos.report.pluginsr   r   r   r   rQ   r   r   <module>rS      s    ? >I< I<r   