o
    O6uf“
  ã                   @   s8   d dl Z d dlmZmZmZmZ G dd„ deeeƒZdS )é    N)ÚPluginÚRedHatPluginÚUbuntuPluginÚ	PluginOptc                   @   s6   e Zd ZdZdZdZdZeddedd�gZ	d	d
„ Z
dS )ÚContainersCommonz;Common container configs under {/etc,/usr/share}/containersÚcontainers_common)Ú	container)zcontainers-commonÚrootlessusersÚ z,colon-delimited list of users to collect for)ÚdefaultÚval_typeÚdescc                    s¦   |   g d¢¡ |  ddi¡ |  d¡}g }|r!dd„ | d¡D ƒ}g d¢}|D ])‰ tj d	ˆ › �¡}|   |› d
�¡ |  dˆ › �¡ | j‡ fdd„|D ƒdd� q'd S )N)z/etc/containers/*z/usr/share/containers/*z/etc/subuidz/etc/subgidz/etc/containers/policy.jsonÚcontainers_policyr	   c                 S   s   g | ]}|r|‘qS © r   )Ú.0Úxr   r   úF/usr/lib/python3/dist-packages/sos/report/plugins/containers_common.pyÚ
<listcomp>)   s    z*ContainersCommon.setup.<locals>.<listcomp>ú:)zpodman infoz%podman unshare cat /proc/self/uid_mapz%podman unshare cat /proc/self/gid_mapzpodman imageszpodman images --digestszpodman pod pszpodman port --allz	podman pszpodman ps -azpodman stats --no-stream --allzpodman versionzpodman volume lszbuildah infoz&buildah unshare cat /proc/self/uid_mapz&buildah unshare cat /proc/self/gid_mapzbuildah containerszbuildah containers --allzbuildah imageszbuildah images --allzbuildah versionú~z/.config/containers/zloginctl user-status c                    s   g | ]
}d ˆ › d|› �‘qS )zmachinectl -q shell z@ /usr/bin/r   )r   Úcmd©Úuserr   r   r   I   s    ÿÿT)Ú
foreground)Úadd_copy_specÚadd_file_tagsÚ
get_optionÚsplitÚosÚpathÚ
expanduserÚadd_cmd_output)ÚselfÚ	users_optÚ
users_listÚuser_subcmdsÚexpanded_userr   r   r   Úsetup   s*   ÿ
ÿþýøzContainersCommon.setupN)Ú__name__Ú
__module__Ú__qualname__Ú
short_descÚplugin_nameÚprofilesÚpackagesr   ÚstrÚoption_listr'   r   r   r   r   r      s    ÿÿr   )r   Úsos.report.pluginsr   r   r   r   r   r   r   r   r   Ú<module>   s   
