o
    O6uf£	  ã                   @   sZ   d dl Z d dl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 )	é    N)ÚPluginÚRedHatPluginÚDebianPluginÚUbuntuPluginc                   @   s,   e Zd ZdZdZdZdZdd„ Zdd„ Zd	S )
ÚCorosynczCorosync cluster engineÚcorosync)Úcluster)r   c              
   C   sø   |   g d¢¡ |  g d¢¡ | jddd� |  d¡ d}|  |¡s#d S d}z8|  d¡}t|d	d
d��!}|D ]}t ||¡rI|   t ||¡ 	d¡¡ q5W d   ƒ W d S 1 sVw   Y  W d S  t
y{ } z|  d|› d|› �¡ W Y d }~d S d }~ww )N)z/etc/corosyncz/var/lib/corosync/fdataz/var/log/cluster/corosync.log*)zcorosync-quorumtool -lzcorosync-quorumtool -szcorosync-cpgtoolzcorosync-cfgtool -szcorosync-blackboxzcorosync-objctl -azcorosync-cmapctl -m statszcorosync-cmapctlÚcorosync_cmapctl)Útagszkillall -USR2 corosyncz/etc/corosync/corosync.confz ^\s*(logging.)?logfile:\s*(\S+)$ÚrzUTF-8)Úencodingé   zcould not read from z: )Úadd_copy_specÚadd_cmd_outputÚexec_cmdÚpath_existsÚ	path_joinÚopenÚreÚmatchÚsearchÚgroupÚIOErrorÚ	_log_warn)ÚselfÚcorosync_confÚpatternÚcconfÚfileÚlineÚerr© r!   ú=/usr/lib/python3/dist-packages/sos/report/plugins/corosync.pyÚsetup   s.   	ÿ


€þ&ÿ$€ÿzCorosync.setupc                 C   s   |   ddd¡ d S )Nzcorosync-objctlz(.*fence.*\.passwd=)(.*)z\1******)Údo_cmd_output_sub)r   r!   r!   r"   Úpostproc;   s
   ýzCorosync.postprocN)	Ú__name__Ú
__module__Ú__qualname__Ú
short_descÚplugin_nameÚprofilesÚpackagesr#   r%   r!   r!   r!   r"   r      s    &r   c                   @   s   e Zd ZdZdS )ÚRedHatCorosyncú0 Parent class Corosync's setup() will be called N)r&   r'   r(   Ú__doc__r!   r!   r!   r"   r-   C   s    r-   c                   @   s   e Zd ZdZdZdS )ÚDebianCorosyncr.   )z/usr/sbin/corosyncN)r&   r'   r(   r/   Úfilesr!   r!   r!   r"   r0   G   s    r0   )	r   Úsos.report.pluginsr   r   r   r   r   r-   r0   r!   r!   r!   r"   Ú<module>   s
   6