o
    id                     @   sV   d dl mZmZmZmZmZ G dd deZG dd deeZG dd deeeZdS )	    )PluginRedHatPluginDebianPluginUbuntuPlugin	PluginOptc                   @   s<   e Zd ZdZdZdZdZdZdZe	ddd	d
gZ
dd ZdS )Apachea  The Apache plugin covers the upstream Apache webserver project,
    regardless of the packaged name; apache2 for Debian and Ubuntu, or httpd
    for Red Hat family distributions.

    The aim of this plugin is for Apache-specific information, not necessarily
    other projects that happen to place logs or similar files within the
    standardized apache directories. For example, OpenStack components that log
    to apache logging directories are excluded from this plugin and collected
    via their respective OpenStack plugins.

    Users can expect the collection of apachectl command output, apache server
    logs, and apache configuration files from this plugin.
    zApache http daemonapache)	webserver	openshift)httpd)z	/var/www/logFzgathers all apache logs)namedefaultdescc                    sD    j ddgdd  j ddd g d}  fd	d
|D  d S )Nzapachectl -Szapachectl -tT)
cmd_as_tagzapachectl -Mhttpd_Mtags)aodh
ceilometercinderforemangnocchihorizonkeystonemanilanovaoctavia	placementpulpc                    s   g | ]	}d  j |f qS )z/var/log/%s*/%s*)	apachepkg).0subself ;/usr/lib/python3/dist-packages/sos/report/plugins/apache.py
<listcomp>>   s    z Apache.setup.<locals>.<listcomp>)add_cmd_outputadd_forbidden_path)r$   subdirsr%   r#   r&   setup&   s   zApache.setupN)__name__
__module____qualname____doc__
short_descplugin_nameprofilespackagesfilesr   option_listr+   r%   r%   r%   r&   r      s    r   c                       s(   e Zd ZdZdZdZ fddZ  ZS )RedHatApachea~  
    On Red Hat distributions, the Apache plugin will also attempt to collect
    JBoss Web Server logs and configuration files.

    Note that for Red Hat distributions, this plugin explicitly collects for
    'httpd' installations. If you have installed apache from source or via any
    method that uses the name 'apache' instead of 'httpd', these collections
    will fail.
    )z/etc/httpd/conf/httpd.confz/etc/httpd22/conf/httpd.confz/etc/httpd24/conf/httpd.confr   c           
         s   |  ddddd tt|   g d}dd |D }g d	}d
d |D }g d}| dd |D  |D ]}|D ]}| jd||f dd q;q7| dsT| drZ| | n|D ]}|D ]}	| d||	f  q`q\| jddd d S )Nhttpd_access_loghttpd_error_loghttpd_ssl_access_loghttpd_ssl_error_log)z/var/log/httpd/access_logz/var/log/httpd/error_logz/var/log/httpd/ssl_access_logz/var/log/httpd/ssl_error_log) 2224c                 S      g | ]}d | qS )z/etc/httpd%sr%   r!   verr%   r%   r&   r'   d       z&RedHatApache.setup.<locals>.<listcomp>)zconf/*.confzconf.d/*.confzconf.modules.d/*.confc                 S   r>   )z/var/log/httpd%sr%   r?   r%   r%   r&   r'   m   rA   )
access_log	error_logssl_access_logssl_error_logc                 S   r>   )z%s/conf/password.confr%   )r!   etcr%   r%   r&   r'   u   s    z%s/%s
httpd_confr   r   all_logsr   systemctl_httpd)add_file_tagssuperr6   r+   r)   add_copy_spec
get_optionadd_service_status)
r$   versetcdirsconfslogdirslogsedirconfldirr   	__class__r%   r&   r+   T   s4   
zRedHatApache.setup)r,   r-   r.   r/   r4   r    r+   __classcell__r%   r%   rW   r&   r6   C   s
    	r6   c                       s$   e Zd ZdZdZ fddZ  ZS )DebianApache)z/etc/apache2/apache2.confapache2c                    s\   t t|   | ddg | d | g d | ds$| dr,| dg d S d S )Nz/etc/apache2/*z/etc/default/apache2r[   )z/var/log/apache2/access.logz/var/log/apache2/error.logz/var/log/apache2/ssl_access.logz/var/log/apache2/ssl_error.logz(/var/log/apache2/other_vhosts_access.logr   rH   z/var/log/apache2)rK   rZ   r+   rL   rN   rM   r#   rW   r%   r&   r+      s   

zDebianApache.setup)r,   r-   r.   r4   r    r+   rY   r%   r%   rW   r&   rZ      s    rZ   N)	sos.report.pluginsr   r   r   r   r   r   r6   rZ   r%   r%   r%   r&   <module>   s   6D