HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sos/report/plugins/__pycache__/charmed_mysql.cpython-310.pyc
o

([Qh��@s2ddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�	PluginOpt�UbuntuPluginc@sReZdZdZdZdZdZeddedd�ed	d
edd�edd
e	dd�gZ
dd�ZdS)�CharmedMySQLa_
    The Charmed MySQL plugin is used to collect MySQL configuration and logs
    from the Charmed MySQL snap package. It also collects MySQL Router
    and MySQL Shell configuration and logs where available,
    journal logs for the snap, and snap info.

    If the `dumpdbs` option is set to `True`, the plugin will also try and
    collect the names of the databases that the user has access to. The
    `mysql` user is used by default, but that can be set using the `dbuser`
    option. When using the `dumpdbs` option, you must then provide the
    password for the user using the `dbpass` option.
    z
Charmed MySQL�
charmed_mysql)z
charmed-mysql�dbuser�mysqlz%Username for database dump collection)�default�val_type�desc�dbpass�z%Password for database dump collection�dumpdbsFzGet name of all databasesc
sZd}d}tdd�tjD��}|rd}d}|�d�|�d�|�d�|�d	�|�d
�d�}|�|d�d
�|d�d�g�|�|d|d|d|d|dg�|s\|�d�|�d�|�d�r�|�d�}|�d�}dtjvr~|s~|j�	d�tjd}n
|s�|j�
d�dSd|i}d|��}d|�d��gd�}	|j�fdd �|	D�|d!�dSdS)"Nz/var/snap/charmed-mysql/commonz/var/snap/charmed-mysql/currentcss�|]}d|vVqdS)�
KUBERNETESN�)�.0�keyrr�B/usr/lib/python3/dist-packages/sos/report/plugins/charmed_mysql.py�	<genexpr>5s�z%CharmedMySQL.setup.<locals>.<genexpr>r
z
/etc/mysqlz/var/log/mysqlz/etc/mysqlrouterz/var/log/mysqlrouterz/var/log/mysqlsh)�
MYSQL_CONF�
MYSQL_LOGS�MYSQL_ROUTER_CONF�MYSQL_ROUTER_LOGS�MYSQL_SHELL_LOGSrz/*.pemz/*.keyrrrrzsnap.charmed-mysql.*zsnap info charmed-mysqlrrr�	MYSQL_PWDzWMYSQL_PWD present: Using MYSQL_PWD environment variable, user did not provide password.zHdumpdbs_error: option is set, but username and password are not providedz-h 127.0.0.1 -uzmysql z -e)z'show databases;'z,'select * from mysql.juju_units_operations;'zR'select * from performance_schema.replication_group_members order by MEMBER_HOST;'z$'show global status like "%conne%";'z.'select * from performance_schema.host_cache;'csg|]	}��d|���qS)� r)r�query��sql_cmdrr�
<listcomp>�sz&CharmedMySQL.setup.<locals>.<listcomp>)�env)�any�os�environ�add_forbidden_path�
add_copy_spec�add_journal�add_cmd_output�
get_option�soslog�info�warning)
�self�snap_path_common�snap_path_current�
k8s_deploy�
conf_paths�db_user�db_pass�	mysql_env�opts�queriesrrr�setup/s`�	��




��

��zCharmedMySQL.setupN)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�packagesr�str�bool�option_listr6rrrrrs&
����r)r"�sos.report.pluginsrrrrrrrr�<module>s