HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/lib/python3.6/site-packages/sos/policies/runtimes/__pycache__/crio.cpython-36.pyc
3

3��d�
�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�ContainerRuntime)�sos_get_command_output)�quotec@s:eZdZdZdZdZdd�Zddd�Zd	d
�Zdd�Z	d
S)�CrioContainerRuntimez-Runtime class to use for systems running crioZcrioZcrictlcCsdS)NF�)�selfrr�/usr/lib/python3.6/crio.py�check_can_copysz#CrioContainerRuntime.check_can_copyFcCszg}d|j|rdndf}|jrvt||jjd�}|ddkrvtj|d�}x*|dD]}|j|d	|d
df�qTW|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%s ps %s -o jsonz-a�)�chroot�statusr�output�
containers�idZmetadata�name)�binary�activer�policy�sysroot�json�loads�append)rZget_allrZ_cmd�out�out_json�	containerrrr�get_containerssz#CrioContainerRuntime.get_containerscCs�g}|jr�td|j|jjd�}|ddkr�tj|d�}x�|dD]|}t|d�dkr~xf|dD]}|j||df�qbWqDt|d	�dkr�d
}n|d	dj	d�d}|j|d|df�qDW|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%s images -o json)rrrr
�imagesZrepoTagsrZrepoDigestsz<none>�@z:<none>)
rrrrrrr�lenr�split)rrrrZimageZrepo_tagZ
image_namerrr�
get_images,s
zCrioContainerRuntime.get_imagescCs8|rt|�}n|}|j|�}|dk	r4d|j||fSdS)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``
        Nz%s %s %sr
)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)rZsos.policies.runtimesrZ
sos.utilitiesrZpipesrrrrrr�<module>
s