관리-도구
편집 파일: lxd.cpython-39.pyc
a -�_gI � @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd� de�ZdS )� N)�ContainerRuntime)�sos_get_command_output)� is_executablec @ sL e Zd ZdZdZdZdd� Zddd�Zd d � Zdd� Z d d� Z ddd�ZdS )�LxdContainerRuntimez,Runtime class to use for systems running LXD�lxd�lxcc C sF t d| jj�rB| jj�d�rB| jj�d�s8| jj�d�rBd| _dS dS )Nr r zsnap.lxd.daemonTF)r �policy�sysrootZpackage_managerZpkg_by_nameZinit_systemZ is_running�active)�self� r �=/usr/lib/python3.9/site-packages/sos/policies/runtimes/lxd.py�check_is_active s ���z#LxdContainerRuntime.check_is_activeFc C sx g }| j � d�}| jrtt|| jjd�}|d dkrtt�|d �}|D ].}|d dksX|rD|�|d d |d f� qD|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 list --format json��chroot�statusr �outputZRunningZexpanded_configz volatile.uuid�name)�binaryr r r r �json�loads�append)r Zget_allZ containersZ_cmd�out�out_json� containerr r r �get_containers"