o
    O6uf
  ã                   @   s&   d dl mZmZ G dd„ deeƒZdS )é    )ÚPluginÚRedHatPluginc                   @   s4   e Zd ZdZdZdZdZdZdZdd„ Z	d	d
„ Z
dS )ÚRedHatInsightsa  Plugin to capture configuration and logging for the Red Hat Insights
    client. Insights is used to provide ongoing analysis of systems for
    proactive problem mitigation, with the client being one of the primary
    sources of data for the service.

    This plugin will capture configuration information under
    /etc/insighits-client, as well as logs from /var/log/insights-client. A
    single connection test via the `insights-client` command is performed and
    recorded as well for troubleshooting purposes.
    z)Red Hat Insights configuration and clientÚinsights)zredhat-access-insightszinsights-client)ÚsystemÚsysmgmt)z)/etc/insights-client/insights-client.confz /etc/insights-client/.registeredz/etc/insights-client/tags.yamlz1/etc/insights-client/malware-detection-config.ymlz7/etc/redhat-access-insights/redhat-access-insights.confz /etc/insights-client/.lastuploadz/etc/insights-client/machine-idc                 C   sp   |   | j¡ |   d¡ |   d¡ |  d¡r|   d¡ n|   d¡ | jddd� d	D ]}| jd
|› �dd� q)d S )Nz/var/lib/insightsz%/var/log/redhat-access-insights/*.logÚall_logsz/var/log/insights-client/*.log*z,/var/log/insights-client/insights-client.logz-insights-client --test-connection --net-debugé   )Útimeout)z	/etc/rhsmz/sys/kernelz/var/lib/sssz/bin/ls -lanR T)Ú
cmd_as_tag)Úadd_copy_specÚconfig_and_statusÚ
get_optionÚadd_cmd_output)ÚselfÚ_dir© r   ú=/usr/lib/python3/dist-packages/sos/report/plugins/insights.pyÚsetup&   s   



þÿzRedHatInsights.setupc                 C   s,   | j D ]}|  |dd¡ |  |dd¡ qd S )Nz(password[\t\ ]*=[\t\ ]*)(.+)z
\1********z(proxy[\t\ ]*=.*)(:)(.*)(@.*)z\1\2********\4)r   Údo_file_sub)r   Úconfr   r   r   Úpostproc:   s   
ÿÿûzRedHatInsights.postprocN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
short_descÚplugin_nameÚpackagesÚprofilesr   r   r   r   r   r   r   r      s    
r   N)Úsos.report.pluginsr   r   r   r   r   r   r   Ú<module>   s   