+
    Û1jI  ã                   óH   € ^ RI t ^ RIHt ^ RIHt ^ RIHt  ! R R]4      tR# )é    N)ÚContainerRuntime)Úsos_get_command_output)Úis_executablec                   óX   a € ] tR t^t o RtRtRtR tRR ltR t	R t
R tRR
 ltRtV tR	# )ÚLxdContainerRuntimez,Runtime class to use for systems running LXDÚlxdÚlxcc                óf  € \        R V P                  P                  4      '       d‹   V P                  P                  P	                  R4      '       d`   V P                  P
                  P                  R4      '       g,   V P                  P
                  P                  R4      '       d
   RV n        R# R# )r	   r   zsnap.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_activeÚ#LxdContainerRuntime.check_is_active   sx   € ä˜% §¡×!4Ñ!4×5Ò5Ø—‘×+Ñ+×7Ñ7¸×>Ò>Ø—‘×(Ñ(×3Ñ3°E×:Ò:Ø—‘×(Ñ(×3Ñ3Ð4E×FÒFØˆDŒKÙÙó    c                ót  € . pV P                    R2pV P                  '       d•   \        W0P                  P                  R7      pVR,          ^ 8X  dg   \
        P                  ! VR,          4      pV FC  pVR,          R8X  g   V'       g   K  VP                  VR,          R,          VR,          34       KE  	  V# )	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ÚstatusÚ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_containersÚ"LxdContainerRuntime.get_containers"   s¡   € ð ˆ
à—+‘+�Ð1Ð2ˆØ�;�;ˆ;Ü(¨·k±k×6IÑ6IÔJˆCà�8�} Ô!ÜŸ:š: c¨(¥mÓ4�ã!)�IØ  Õ*¨iÔ7¿7¹7à"×)Ñ)Ø&Ð'8Õ9¸/ÕJØ& vÕ.ð0ö1ñ "*ð Ðr   c                óT  € . pV P                   '       d”   \        V P                   R2V P                  P                  R7      pVR,          ^ 8X  dX   \
        P                  ! VR,          4      pV F4  pRV9   g   K  VP                  VR,          R,          VR,          34       K6  	  V# )z|Get 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 jsonr   r   r   Úupdate_sourceÚaliasÚfingerprint©r   r   r   r   r   r    r!   r"   )r   Úimagesr&   r'   Úents   &    r   Ú
get_imagesÚLxdContainerRuntime.get_images:   s—   € ð ˆØ�;�;ˆ;Ü(Ø—;‘;�-Ð8Ð9Ø—{‘{×*Ñ*ôˆCð �8�} Ô!ÜŸ:š: c¨(¥mÓ4�Û#�Cà&¨#Ö-ØŸ™Ø Õ0°Õ9Ø Õ.ð'0ö 1ñ $ð ˆr   c                ó`  € . pRpV P                   '       Ed   \        V P                   R2V P                  P                  R7      pVR,          ^ 8X  d^   \
        P                  ! VR,          4      pV F:  pVR,          R8X  g   K  RVR,          9   g   K#  VR,          R,          R	,          p M	  \        V P                   R
V R2V P                  P                  R7      pVR,          ^ 8X  d?   \
        P                  ! VR,          4      pV F  pVP                  VR,          4       K  	  V# )zuGet a list of container volumes present on the system

:returns: A list of volume IDs on the system
:rtype: ``list``
Údefaultz profile list --format jsonr   r   r   r   ÚrootÚdevicesÚpoolz storage volume list z --format jsonr/   )r   ÚvolsÚstg_poolr&   r'   Úprofiler1   s   &      r   Úget_volumesÚLxdContainerRuntime.get_volumesP   s  € ð ˆØˆØ�;�;‰;ô )Ø—;‘;�-Ð:Ð;Ø—{‘{×*Ñ*ôˆCð �8�} Ô!ÜŸ:š: c¨(¥mÓ4�Û'�GØ �¨9Ö4Ø" g¨iÕ&8Ö8Ø#*¨9Õ#5°fÕ#=¸fÕ#E˜Ùñ	  (ô )Ø—;‘;�-Ð4°X°J¸nÐMØ—{‘{×*Ñ*ôˆCð �8�} Ô!ÜŸ:š: c¨(¥mÓ4�Û#�CØ—K‘K  F¥Ö,ñ $àˆr   c                ó&   € V P                    RV R2# )zñ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   )r   r(   s   &&r   Úget_logs_commandÚ$LxdContainerRuntime.get_logs_commandq   s   € ð —+‘+�˜f Y K¨{Ð;Ð;r   Nc                ól   € V'       d   V P                    RV RV RV 2# V P                   RV V RV 2# )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   )r   r(   ÚpathÚdestÚ	sizelimits   &&&&&r   Úget_copy_commandÚ$LxdContainerRuntime.get_copy_command}   sG   € ÷, Ø—l‘l�^ 1 Y K¨y¸¸À1ÀTÀFÐKÐKØ—+‘+�˜k¨)¨°T°F¸!¸D¸6ÐBÐBr   )r   )F)N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r)   r2   r<   r?   rG   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      s8   ø‡ € Ù6à€DØ€Fòôò0ò,òB
<÷Cò Cr   r   )r    Úsos.policies.runtimesr   Úsos.utilitiesr   r   r   © r   r   Ú<module>rT      s$   ðó å 2Ý 0Ý 'ôCCÐ*ö CCr   