o
    *bè	  ã                   @   s.   d dl Z d dlmZmZ G dd„ deeƒZdS )é    N)ÚPluginÚIndependentPluginc                   @   s>   e Zd ZdZdZdZdZefZdZdd„ Z	dd	„ Z
d
d„ ZdS )ÚClearContainersz'Intel(R) Clear Containers configurationZclear_containers)ÚsystemZvirtÚ	containerz
cc-runtime)zcc-proxyc                 C   sV   dg}d  | j¡}|  |¡d }| ¡ D ]}|dkr| |¡ qt|ƒ}|  |¡ d S )Nz_/etc/clear-containers/configuration.toml/usr/share/defaults/clear-containers/configuration.tomlz!{} --cc-show-default-config-pathsÚoutputÚ )ÚformatÚruntimeÚexec_cmdÚ
splitlinesÚappendÚsetÚadd_copy_spec)ÚselfZconfig_filesÚcmdZconfigsZconfig© r   úE/usr/lib/python3/dist-packages/sos/report/plugins/clear_containers.pyÚattach_cc_config_files   s   ÿ
€z&ClearContainers.attach_cc_config_filesc                 C   st   dg}d  | j¡}|  |¡d }| ¡ D ]}t d|¡}|r,| d¡}|r*| |¡  nqt|ƒ}|  	|| j
¡ d S )Nz-/var/lib/clear-containers/runtime/runtime.logú	{} cc-envr   z\bGlobalLogPath\b\s+=\s+"(.+)"é   )r	   r
   r   r   ÚreÚsearchÚgroupr   r   r   Úlimit)r   Z	log_filesr   r   ÚlineÚresultZglobal_logfiler   r   r   Úattach_cc_log_files.   s   ÿ

üz#ClearContainers.attach_cc_log_filesc                 C   sN   |   d¡| _|   d¡rd | _|  d | j¡¡ |  ¡  |  ¡  | jdd d S )NZlog_sizeZall_logsr   zcc-shim)Z
identifier)Z
get_optionr   Zadd_cmd_outputr	   r
   r   r   Zadd_journal)r   r   r   r   ÚsetupD   s   
zClearContainers.setupN)Ú__name__Ú
__module__Ú__qualname__Z
short_descZplugin_nameZprofilesr
   ZpackagesÚservicesr   r   r   r   r   r   r   r      s    r   )r   Zsos.report.pluginsr   r   r   r   r   r   r   Ú<module>   s   