o
    *b
                     @   s8   d dl mZmZmZmZ d dlZG dd deeeZdS )    )PluginRedHatPluginUbuntuPlugin	PluginOptNc                   @   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}/containersZcontainers_common)	container)zcontainers-commonrootlessusers z,colon-delimited list of users to collect for)defaultZval_typeZdescc                    s   |  g d | d}g }|rdd |dD }g d}|D ]$ |  dtjd    | d	   | j fd
d|D dd q d S )N)z/etc/containers/*z/usr/share/containers/*z/etc/subuidz/etc/subgidr   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 versionz%s/.config/containers/z~%szloginctl user-status %sc                    s   g | ]}d  |f qS )z#machinectl -q shell %s@ /usr/bin/%sr   )r   cmduserr   r   r   D   s    
T)Z
foreground)Zadd_copy_specZ
get_optionsplitospath
expanduserZadd_cmd_output)selfZ	users_optZ
users_listZuser_subcmdsr   r   r   setup   s"   
zContainersCommon.setupN)__name__
__module____qualname__Z
short_descZplugin_nameZprofilesZpackagesr   strZoption_listr   r   r   r   r   r      s    r   )Zsos.report.pluginsr   r   r   r   r   r   r   r   r   r   <module>   s   
