o
    O6ufï  ã                   @   s8   d dl mZmZ d dlmZ dd„ ZG dd„ deƒZdS )é    )Ú	CosPluginÚIndependentPlugin)ÚLinuxPolicyc                 C   s   |   ¡  p|  ¡  d¡S )aH  Test whether line is empty of contains a comment.

        Test whether the ``line`` argument is either blank, or a
        whole-line comment.

        :param line: the line of text to be checked.
        :returns: ``True`` if the line is blank or a comment,
                  and ``False`` otherwise.
        :rtype: bool
    ú#)ÚstripÚlstripÚ
startswith)Úline© r
   ú:/usr/lib/python3/dist-packages/sos/policies/distros/cos.pyÚ_blank_or_comment   s   r   c                       sJ   e Zd ZdZdZdgZeegZdZ			d‡ fdd„	Z
edd
d„ƒZ‡  ZS )Ú	CosPolicyzContainer-Optimized OSzGoogle Cloud Platform)zDistribution Websitez0https://cloud.google.com/container-optimized-os/z</usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbinNTc                    s(   t ƒ j||||d� |  jtg7  _d S )N)ÚsysrootÚinitÚprobe_runtimeÚremote_exec)ÚsuperÚ__init__Úvalid_subclassesr   )Úselfr   r   r   r   ©Ú	__class__r
   r   r   '   s
   
þzCosPolicy.__init__Ú c              	   C   sx   |r| j |v S z(tddƒ�}tdd„ |D ƒƒ}|d dkW  d   ƒ W S 1 s(w   Y  W d S  ttfy;   Y dS w )Nz/etc/os-releaseÚrc                 s   s&   � | ]}t |ƒs| ¡  d ¡V  qdS )ú=N)r   r   Úsplit)Ú.0r	   r
   r
   r   Ú	<genexpr>5   s   € ÿz"CosPolicy.check.<locals>.<genexpr>ÚIDÚcosF)ÚdistroÚopenÚdictÚIOErrorÚKeyError)ÚclsÚremoteÚfpÚ
os_releaser
   r
   r   Úcheck.   s   

(ýÿzCosPolicy.check)NNTN)r   )Ú__name__Ú
__module__Ú__qualname__r    ÚvendorÚvendor_urlsr   r   r   ÚPATHr   Úclassmethodr)   Ú__classcell__r
   r
   r   r   r      s    ÿÿr   N)Úsos.report.pluginsr   r   Úsos.policies.distrosr   r   r   r
   r
   r
   r   Ú<module>   s   
