File: //usr/lib/python3/dist-packages/sos/policies/runtimes/__pycache__/lxd.cpython-310.pyc
o
-�_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�r!| jj�d�r!| jj�d�s| jj�d�r!d| _dS dS )Nr r zsnap.lxd.daemonTF)r �policy�sysroot�package_manager�pkg_by_name�init_system�
is_running�active)�self� r �;/usr/lib/python3/dist-packages/sos/policies/runtimes/lxd.py�check_is_active s ���z#LxdContainerRuntime.check_is_activeFc C sx g }| j � d�}| jr:t|| jjd�}|d dkr:t�|d �}|D ]}|d dks,|r9|�|d d |d 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 list --format json��chroot�statusr �output�Running�expanded_configz
volatile.uuid�name)�binaryr r r r �json�loads�append)r �get_all�
containers�_cmd�out�out_json� containerr r r �get_containers"