📂 FileMgr
📍
/
usr
/
lib
/
python3
/
dist-packages
/
sos
/
policies
/
runtimes
/
__pycache__
✏️ /usr/lib/python3/dist-packages/sos/policies/runtimes/__pycache__/lxd.cpython-312.pyc
✕ Tutup
� G%@iI � �F � d dl Z d dlmZ d dlmZ d dlmZ G d� de� Zy)� N)�ContainerRuntime)�sos_get_command_output)� is_executablec �@ � e Zd ZdZdZdZd� Zdd�Zd� Zd� Z d� Z dd �Zy ) �LxdContainerRuntimez,Runtime class to use for systems running LXD�lxd�lxcc �2 � t d| j j � rw| j j j d� rR| j j j d� s%| j j j d� rd| _ yy)Nr r zsnap.lxd.daemonTF)r �policy�sysroot�package_manager�pkg_by_name�init_system� is_running�active)�selfs �;/usr/lib/python3/dist-packages/sos/policies/runtimes/lxd.py�check_is_activez#LxdContainerRuntime.check_is_active sl � ��%����!4�!4�5����+�+�7�7��>����(�(�3�3�E�:����(�(�3�3�4E�F��D�K��� c � � g }| j � d�}| j rot || j j �� }|d dk( rFt j |d � }|D ]) }|d dk( s|s�|j |d d |d f� �+ |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� containers r �get_containersz"LxdContainerRuntime.get_containers"