Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/sos/report/plugins/__pycache__/pacemaker.cpython-38.pyc

U

-�_g?�@szddlZddlmZmZddlmZmZmZmZmZddl	m
Z
Gdd�de�ZGdd�deee�ZGd	d
�d
ee�Z
dS)�N)�datetime�	timedelta)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPlugin�	PluginOpt)�sos_parse_versionc@sneZdZdZdZdZdZeddedd�ed	d
dd�gZ	dZ
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�	Pacemakerz4Pacemaker high-availability cluster resource manager�	pacemaker)Zcluster)rzpacemaker-remote�crm-from�z%specfiy the start time for crm_report)�defaultZval_type�desc�	crm-scrubTz$enable crm_report password scrubbing)rrcCs|�d�dS)z Get cluster summary zcrm_mon -1 -A -n -r -tN��add_cmd_output��self�r�>/usr/lib/python3/dist-packages/sos/report/plugins/pacemaker.py�
setup_crm_mon$szPacemaker.setup_crm_moncCs|�ddg�dS)z& Get cluster status and configuration z
crm status�crm configure showNrrrrr�setup_crm_shell(s�zPacemaker.setup_crm_shellcCs�|jj�d�}|dkrdS|�d�|�dddg�d�|d�}t|�td	�kr^|�d
�n
|�d�|jdd
d�|jddd�|jddd�dS)z& Get pacemaker/corosync configuration ZpcsNz/var/log/pcsd/pcsd.logzpcs stonith sbd status --fullzpcs stonith sbd watchdog listzpcs stonith history show�.�versionz0.10.8zpcs property config --allzpcs property list --all�
pcs configZ
pcs_config)Ztagszpcs quorum statusZpcs_quorum_statuszpcs status --fullZ
pcs_status)ZpolicyZpackage_managerZpkg_by_name�
add_copy_specr�joinr	)rZpcs_pkgZpcs_versionrrr�	setup_pcs/s 
�
zPacemaker.setup_pcscCs|�ddd�dS)� Clear password r�passw([^\s=]*)=\S+�passw\1=********N�Zdo_cmd_output_subrrrr�postproc_crm_shellFs
�zPacemaker.postproc_crm_shellcCs|�ddd�dS)r rr!r"Nr#rrrr�postproc_pcsNs
�zPacemaker.postproc_pcsc		Csf|�dddddddg�|��t��tdd��d	�}|�d
�r|t�dt	|�d
���rd|�d
�}n|�
d|�d
��d
��|jddd�}|�d�r�d}nd}|�d�|�d�|j
d|�d|�d|�d�|��d�d}|�|j��rb|�|j�t|jddd��V}|D]J}t�||��rt�||��d�}d D]}t�|d|�}�q4|�|��qW5QRXdS)!Nz!/var/log/pacemaker/pacemaker.log*z/var/log/pacemaker/bundles/*/z/var/log/pacemaker/pengine*z/var/log/pacemaker.logz/var/log/cluster/pacemaker.log*z/var/log/cluster/bundles/*/�H)Zhoursz%Y-%m-%d %H:%m:%Srz#\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}zcrm_from parameter 'z$' is not a valid date: using defaultZ
crm_reportF)�nameZmakerz-p "passw.*"r
z-scrubbing of crm passwords has been disabled:z:data collected by crm_report may contain sensitive values.zcrm_report --sos-mode z -S -d  --dest z	 --from "�")�chrootz0^\s*PCMK_logfile=[\'\"]?(\S+)[\'\"]?\s*(\s#.*)?$�rzUTF-8)�encoding�)z^"z"$z^\'z\'$)rrrZtodayr�strftimeZ
get_option�re�match�strZ
_log_errorZget_cmd_output_pathZ	_log_warnrZtmp_in_sysrootZpath_isfile�envfile�open�search�group�sub)	rZcrm_fromZcrm_destZ	crm_scrub�pattern�file�lineZlogfileZregexprrr�setupVsT���
��


�zPacemaker.setupN)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesZpackagesrr0Zoption_listr1rrrr$r%r9rrrrr
s$���r
cs$eZdZ�fdd�Zdd�Z�ZS)�DebianPacemakercs*|�d�|_|��|��t���dS)Nz/etc/default/pacemaker)�	path_joinr1rr�superr9r��	__class__rrr9�szDebianPacemaker.setupcCs|��|��dS�N)r$r%rrrr�postproc�szDebianPacemaker.postproc�r:r;r<r9rC�
__classcell__rrr@rr=�sr=cs$eZdZ�fdd�Zdd�Z�ZS)�RedHatPacemakercs,|�d�|_|��|�d�t���dS)Nz/etc/sysconfig/pacemakerz/etc/sysconfig/sbd)r>r1rrr?r9rr@rrr9�s
zRedHatPacemaker.setupcCs|��dSrB)r%rrrrrC�szRedHatPacemaker.postprocrDrrr@rrF�srF)r.rrZsos.report.pluginsrrrrrZ
sos.utilitiesr	r
r=rFrrrr�<module>	s