3
ܓim
@ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS ) N)quote)ContainerRuntime)sos_get_command_outputc @ s: e Zd ZdZdZdZdd ZdddZd d
Zdd Z d
S )CrioContainerRuntimez-Runtime class to use for systems running crioZcrioZcrictlc C s dS )NF )selfr r /usr/lib/python3.6/crio.pycheck_can_copy s z#CrioContainerRuntime.check_can_copyFc C s~ g }| j d|rdnd d}| jrzt|| jjd}|d dkrztj|d }x*|d D ]}|j|d
|d d f qXW |S )
zGet 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)chrootstatusr output
containersidZmetadataname)binaryactiver policysysrootjsonloadsappend)r Zget_allr Z_cmdoutout_json containerr r r get_containers s z#CrioContainerRuntime.get_containersc C s g }| j rt| j d| jjd}|d dkrtj|d }x|d D ]|}t|d dkrxf|d D ]}|j||d f qdW qFt|d dkrd
}n|d d j dd }|j|d |d f qFW |S )
zGet a list of images present on the system
:returns: A list of 2-tuples containing (image_name, image_id)
:rtype: ``list``
z images -o json)r r r r
imagesZrepoTagsr ZrepoDigestsz