관리-도구
편집 파일: crio.cpython-39.pyc
a -�_gm � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�quote)�ContainerRuntime)�sos_get_command_outputc @ s: e Zd ZdZdZdZdd� Zddd�Zd d � Zdd� Z d S )�CrioContainerRuntimez-Runtime class to use for systems running crioZcrioZcrictlc C s dS )NF� )�selfr r �>/usr/lib/python3.9/site-packages/sos/policies/runtimes/crio.py�check_can_copy s z#CrioContainerRuntime.check_can_copyFc C sz g }| j � d|rdnd� d�}| jrvt|| jjd�}|d dkrvt�|d �}|d D ]}|�|d |d d 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)r Zget_allr Z_cmd�out�out_json� containerr r r �get_containers s �z#CrioContainerRuntime.get_containersc C s� g }| j r�t| j� d�| jjd�}|d dkr�t�|d �}|d D ]x}t|d �dkrz|d D ]}|�||d f� q`qDt|d �dkr�d }n|d d � d�d }|�|d |d f� 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 jsonr r r r �imagesZrepoTagsr ZrepoDigestsz<none>�@z:<none>) r r r r r r r �lenr �split)r r r r ZimageZrepo_tagZ image_namer r r � get_images, s �zCrioContainerRuntime.get_imagesc C s>