U
    -Ø_g¬  ã                   @   s.   d dl Z d dlmZmZ G dd„ deeƒZdS )é    N)ÚPluginÚUbuntuPluginc                   @   s0   e Zd ZdZdZdZdZdZdd„ Zdd	„ Z	d
S )Ú	LandscapezUbuntu Landscape clientZ	landscape)Zsysmgmt)ú/etc/landscape/client.confú/etc/landscape/service.conf)zlandscape-clientzlandscape-serverc                 C   sš   dd„ dD ƒ}t |ƒs$| j d¡ n$|  ddddg¡ |  d	d
ddg¡ |  ddddddg¡ |  d¡sx|  ddg¡ n|  ddg¡ |  dddg¡ d S )Nc                 S   s   g | ]}|t jk‘qS © )ÚosÚenviron)Ú.0Úpr   r   ú>/usr/lib/python3/dist-packages/sos/report/plugins/landscape.pyÚ
<listcomp>   s     z#Landscape.setup.<locals>.<listcomp>)ZLANDSCAPE_API_KEYZLANDSCAPE_API_SECRETZLANDSCAPE_API_URIz¬Not all environment variables set. Source the environment file for the user intended to connect to the Landscape environment so that the landscape-api commands can be used.zlandscape-api get-distributionszlandscape-api get-apt-sourcesz%landscape-api get-repository-profilesz'landscape-api get activites --limit 100z&landscape-api --json get-distributionsz$landscape-api --json get-apt-sourcesz,landscape-api --json get-repository-profilesz.landscape-api --json get activites --limit 100z/etc/default/landscape-clientz/etc/default/landscape-serverr   r   z/etc/landscape/service.conf.oldz*/var/lib/landscape/landscape-oops/*/OOPS-*Zall_logsz/var/log/landscape/*.logz/var/log/landscape-server/*.logz/var/log/landscapez/var/log/landscape-serverz'gpg --verify /etc/landscape/license.txtz$head -n 5 /etc/landscape/license.txtzlsctl status)ÚallZsoslogZwarningZadd_cmd_outputZadd_copy_specZ
get_option)ÚselfZvars_allr   r   r   Úsetup   sJ    üüú	
þþýzLandscape.setupc                 C   s<   |   ddd¡ dddddg}|  d	d
d |¡› dd¡ d S )Nr   zregistration_password(.*)zregistration_password[********]ZpasswordZstore_passwordzsecret-tokenzoidc-client-secretzoidc-client-idz/etc/landscape/service.conf*ú(ú|z) = (.*)z\1 = [********])Zdo_file_subZdo_path_regex_subÚjoin)r   Úkeysr   r   r   ÚpostprocL   s     ýûýzLandscape.postprocN)
Ú__name__Ú
__module__Ú__qualname__Z
short_descZplugin_nameZprofilesÚfilesZpackagesr   r   r   r   r   r   r      s   6r   )r   Zsos.report.pluginsr   r   r   r   r   r   r   Ú<module>	   s   