§ ½@¾j‰ãóH—ddlZddlZddlmZmZgd¢ZGd„d¦«ZdS)éN)ÚExternalProgramFailedÚ run_command)z/usr/sbin/mysqldz/usr/libexec/mysqldz/usr/local/bin/mysqldcóH—eZdZd„Zed„¦«Zd„Zd„Zd„Zd„Z d„Z dS) Ú MysqlInfocó8—| ¦«|_dS)N)Úretrieve_server_infoÚmysqld_v©Úselfs úpy/clconfig/db_info_lib.pyÚ__init__zMysqlInfo.__init__s€Ø×1Ò1Ñ3Ô3ˆŒ ˆ ˆ ócó²— tD]%}tj |¦«r|cSŒ&tdS#t$rtdcYSwxYw)zP Find mysql server binary :return: path to mysql binary é)ÚMYSQL_BINARIESÚosÚpathÚexistsÚOSError)Úbinarys r Ú get_binaryzMysqlInfo.get_binarysq€ð  %Ý(ð "ð "�Ý”7—>’> &Ñ)Ô)ð"Ø!�M�M�Mð"å! !Ô$Ð $øÝð %ð %ð %Ý! !Ô$Ð $Ð $Ð $ð %øøøs‚+<® <¼AÁAcóp— | ¦«}t|dg¦«S#t$rYdSwxYw)zx Get server information through ` -V` command :return: full command output z-VN)rrr)r Ú mysql_binarys r rzMysqlInfo.retrieve_server_info%sK€ð  ØŸ?š?Ñ,Ô,ˆLÝ  ¨dÐ3Ñ4Ô4Ð 4øÝ$ð ð ð à�4�4ð øøøs ‚$'§ 5´5cóz—| ¦«| ¦«| ¦«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) ) )ÚvendorÚversionúcll-lve)Ú get_vendorÚ get_versionÚ is_patchedr s r Úgetz MysqlInfo.get1s7€ðŸ/š/Ñ+Ô+¸×8HÒ8HÑ8JÔ8JÐW[×WfÒWfÑWhÔWhÐiÐiÐircóЗ|j€dStjd¦«} | |j¦«d ¦«dS#t $rYdSwxYw)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 Úps r rzMysqlInfo.get_vendor<st€ð Œ=Ð Ø�4õ ŒJÐ/Ñ 0Ô 0ˆð à—9’9˜Tœ]Ñ+Ô+¨AÔ.×4Ò4Ñ6Ô6°qÔ9Ð 9øÝð ð ð Ø�9�9ð øøøsŸ7AÁ A%Á$A%cóÆ—|j€dStjd¦«} | |j¦«d d¦«S#t $rYdSwxYw)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#)r r$r%r&Úrstripr(r)s r rzMysqlInfo.get_versionNsq€ð Œ=Ð Ø�4õ ŒJÐ.Ñ /Ô /ˆð à—9’9˜Tœ]Ñ+Ô+¨AÔ.×5Ò5°cÑ:Ô:Ð :øÝð ð ð Ø�9�9ð øøøsŸ2AÁ A ÁA có&—|j€dSd|jvS)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) Nr)r r s r r zMysqlInfo.is_patched`s€ð Œ=Ð Ø�4ؘDœMÐ)Ð)rN) Ú__name__Ú __module__Ú __qualname__r Ú staticmethodrrr!rrr ©rr rrsŒ€€€€€ð4ð4ð4ðð %ð %ñ„\ð %ð ð ð ð jð jð jðððð$ððð$ *ð *ð *ð *ð *rr)rr$Úclcommon.utilsrrrrr3rr úr5s~ðð € € € Ø € € € à=Ð=Ð=Ð=Ð=Ð=Ð=Ð=ððð€ðV*ðV*ðV*ðV*ðV*ñV*ôV*ðV*ðV*ðV*r