HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/sos/policies/runtimes/__pycache__/crio.cpython-39.pyc
a

\��hm
�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�quote)�ContainerRuntime)�sos_get_command_outputc@s:eZdZdZdZdZdd�Zddd�Zd	d
�Zdd�Z	d
S)�CrioContainerRuntimez-Runtime class to use for systems running crioZcrioZcrictlcCsdS)NF�)�selfrr�>/usr/lib/python3.9/site-packages/sos/policies/runtimes/crio.py�check_can_copysz#CrioContainerRuntime.check_can_copyFcCszg}|j�d|rdnd�d�}|jrvt||jjd�}|ddkrvt�|d�}|d	D]}|�|d
|ddf�qV|S)
z�Get a list of containers present on the system.

        :param get_all: If set, include stopped containers as well
        :type get_all: ``bool``
        z ps z-a�z -o json��chroot�statusr�output�
containers�id�metadata�name)�binary�activer�policy�sysroot�json�loads�append)rZget_allrZ_cmd�out�out_json�	containerrrr�get_containerss�z#CrioContainerRuntime.get_containerscCs�g}|jr�t|j�d�|jjd�}|ddkr�t�|d�}|dD]x}t|d�dkrz|dD]}|�||df�q`qDt|d	�dkr�d
}n|d	d�	d�d}|�|d|df�qD|S)
z�Get a list of images present on the system

        :returns: A list of 2-tuples containing (image_name, image_id)
        :rtype: ``list``
        z images -o jsonrr
rr�imagesZrepoTagsrZrepoDigestsz<none>�@z:<none>)
rrrrrrr�lenr�split)rrrrZimageZrepo_tagZ
image_namerrr�
get_images,s �zCrioContainerRuntime.get_imagescCs>|rt|�}n|}|�|�}|dur:|j�d|�d|��SdS)a�Format a command to run inside a container using the runtime

        :param container: The name or ID of the container in which to run
        :type container: ``str``

        :param cmd: The command to run inside `container`
        :type cmd: ``str``

        :param quotecmd: Whether the cmd should be quoted.
        :type quotecmd: ``bool``

        :returns: Formatted string to run `cmd` inside `container`
        :rtype: ``str``
        N� r
)rZget_container_by_nameZrun_cmd)rr�cmdZquotecmdZ
quoted_cmdZcontainer_idrrr�fmt_container_cmdEs

��z&CrioContainerRuntime.fmt_container_cmdN)F)
�__name__�
__module__�__qualname__�__doc__rrr	rr"r%rrrrrs
r)rZshlexrZsos.policies.runtimesrZ
sos.utilitiesrrrrrr�<module>
s