/usr/lib/python3/dist-packages/sos/policies/runtimes/__pycache__
NameSizeModeActions
crio.cpython-310.pyc28220644editdlrm
docker.cpython-310.pyc9780644editdlrm
lxd.cpython-310.pyc43890644editdlrm
podman.cpython-310.pyc4860644editdlrm
__init__.cpython-310.pyc86630644editdlrm
Edit: /usr/lib/python3/dist-packages/sos/policies/runtimes/__pycache__/lxd.cpython-310.pyc (4389B)
o G%@iI@s@ddlZddlmZddlmZddlmZGdddeZdS)N)ContainerRuntime)sos_get_command_output) is_executablec@sLeZdZdZdZdZddZdddZd d Zd d Z d dZ dddZ dS)LxdContainerRuntimez,Runtime class to use for systems running LXDlxdlxccCsFtd|jjr!|jjdr!|jjds|jjdr!d|_dSdS)Nrrzsnap.lxd.daemonTF)rpolicysysrootpackage_manager pkg_by_name init_system is_runningactive)selfr;/usr/lib/python3/dist-packages/sos/policies/runtimes/lxd.pycheck_is_actives   z#LxdContainerRuntime.check_is_activeFcCsxg}|jd}|jr:t||jjd}|ddkr:t|d}|D]}|ddks,|r9||dd|d fq"|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 list --format jsonchrootstatusroutputRunningexpanded_configz volatile.uuidname)binaryrrrr jsonloadsappend)rget_all containers_cmdoutout_json containerrrrget_containers"s   z"LxdContainerRuntime.get_containerscCslg}|jr4t|jd|jjd}|ddkr4t|d}|D]}d|vr3||dd|dfq |S) zGet a list of images present on the system :returns: A list of 2-tuples containing (image_name, image_id) :rtype: ``list`` z image list --format jsonrrrr update_sourcealias fingerprintrrrrr rrr)rimagesr!r"entrrr get_images:s    zLxdContainerRuntime.get_imagescCsg}d}|jrct|jd|jjd}|ddkr;t|d}|D]}|ddkr:d|d vr:|d dd }nq"t|jd |d |jjd}|ddkrct|d}|D] }||dqY|S) zGet a list of container volumes present on the system :returns: A list of volume IDs on the system :rtype: ``list`` defaultz profile list --format jsonrrrrrrootdevicespoolz storage volume list z --format jsonr()rvolsstg_poolr!r"profiler*rrr get_volumesPs0     zLxdContainerRuntime.get_volumescCs|jd|dS)a!Get the command string used to dump container logs from the runtime :param container: The name or ID of the container to get logs for :type container: ``str`` :returns: Formatted runtime command to get logs from `container` :type: ``str`` z info z --show-log)r)rr#rrrget_logs_commandqs z$LxdContainerRuntime.get_logs_commandNcCs:|r|jd|d|d|S|jd||d|S)a,Generate the command string used to copy a file out of a container by way of the runtime. :param container: The name or ID of the container :type container: ``str`` :param path: The path to copy from the container. Note that at this time, no supported runtime supports globbing :type path: ``str`` :param dest: The destination on the *host* filesystem to write the file to :type dest: ``str`` :param sizelimit: Limit the collection to the last X bytes of the file at PATH :type sizelimit: ``int`` :returns: Formatted runtime command to copy a file from a container :rtype: ``str``  z tail -c z file pull )run_cmdr)rr#pathdest sizelimitrrrget_copy_command}sz$LxdContainerRuntime.get_copy_command)F)N) __name__ __module__ __qualname____doc__rrrr$r+r3r4r:rrrrrs ! r)rsos.policies.runtimesr sos.utilitiesrrrrrrrs