https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/policies/runtimes/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/policies/runtimes/__pycache__/crio.cpython-310.pyc
o

-�_gm
�@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 crio�crio�crictlcCsdS)NF�)�selfrr�</usr/lib/python3/dist-packages/sos/policies/runtimes/crio.py�check_can_copysz#CrioContainerRuntime.check_can_copyFcCszg}|j�d|r
dnd�d�}|jr;t||jjd�}|ddkr;t�|d�}|d	D]}|�|d
|ddf�q+|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)r	�get_allr�_cmd�out�out_json�	containerrrr
�get_containerss�z#CrioContainerRuntime.get_containerscCs�g}|jr_t|j�d�|jjd�}|ddkr_t�|d�}|dD]<}t|d�dkr=|dD]}|�||df�q0q"t|d	�dkrHd
}n|d	d�	d�d}|�|d|df�q"|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 jsonr
rrr�images�repoTagsr�repoDigestsz<none>�@z:<none>)
rrrrrrr�lenr�split)r	r"rr�image�repo_tag�
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)r�get_container_by_name�run_cmd)r	r �cmd�quotecmd�
quoted_cmd�container_idrrr
�fmt_container_cmdEs

��z&CrioContainerRuntime.fmt_container_cmdN)F)
�__name__�
__module__�__qualname__�__doc__rrrr!r+r3rrrr
rs
r)r�shlexr�sos.policies.runtimesr�
sos.utilitiesrrrrrr
�<module>s
	

https://t.me/RX1948 - 2025