HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/clconfig/__pycache__/db_info_lib.cpython-37.pyc
B

:<��)���@s@ddlmZddlZddlZddlmZmZGdd�de�ZdS)�)�absolute_importN)�run_command�ExternalProgramFailedc@sHeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�	MysqlInfocCs|��|_dS)N)�retrieve_server_info�mysqld_v)�self�r	�py/clconfig/db_info_lib.py�__init__szMysqlInfo.__init__cCs(yt�d�dStk
r"dSXdS)zP
        Find mysql server binary
        :return: path to mysql binary
        z/usr/sbin/mysqldz/usr/libexec/mysqldN)�os�stat�OSErrorr	r	r	r
�
get_binarys

zMysqlInfo.get_binarycCs*yt|��dg�Stk
r$dSXdS)zx
        Get server information through `<mysql_server_binary> -V` command
        :return: full command output
        z-VN)rrr)rr	r	r
rszMysqlInfo.retrieve_server_infocCs|��|��|��d�S)a&
        Return gathered data
        :return: dict(
            'vendor': MySQL|MariaDB|Percona,
            'version': server version in the form of {major}.{minor} or {major}.{minor}-{release} for percona,
            'cll-lve': patches from CL applied or not (True|False)
        )
        )Zvendor�versionzcll-lve)�
get_vendor�get_version�
is_patched)rr	r	r
�get(s
z
MysqlInfo.getcCsJ|jdkrdSt�d�}y|�|j�d��dStk
rDdSXdS)z�
        Extract MySQL vendor from server info
        :return: MySQL|MariaDB|Percona or
                `unknown` if failed to apply regex or
                None if there is no server info (this usually means that there are no MySQL installed)
        Nz(?<=\().+(?=\sServer)r�unknown)r�re�compile�findall�split�
IndexError)r�pr	r	r
r7s

zMysqlInfo.get_vendorcCsH|jdkrdSt�d�}y|�|j�d�d�Stk
rBdSXdS)aF
        Retrieve MySQL server version from server info
        :return: X.X.X e.g. 10.2.16|5.6.39, includes release for percona (X.X.X-X.X e.g. 5.6.40-84.0) or
                `unknown` if failed to apply regex or
                None if there is no server info (this usually means that there are no MySQL installed)
        Nz(?<=Ver\s)[0-9\.\-]+r�-r)rrrr�rstripr)rrr	r	r
rIs

zMysqlInfo.get_versioncCs|jdkrdSd|jkS)a
        Retrieve information about CL patch by `cll-lve` in server info
        :return: True if contains `cll-lve` seq
                False otherwise or
                None if there is no server info (this usually means that there are no MySQL installed)
        Nzcll-lve)r)rr	r	r
r[s
zMysqlInfo.is_patchedN)�__name__�
__module__�__qualname__r�staticmethodrrrrrrr	r	r	r
r
sr)	Z
__future__rrrZclcommon.utilsrr�objectrr	r	r	r
�<module>s