\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /lib/mysqlsh/python-packages/mysqlsh/plugin_manager/__pycache__/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : //lib/mysqlsh/python-packages/mysqlsh/plugin_manager/__pycache__/repositories.cpython-38.pyc |
U
�C�e76 � @ s� d dl Zd dlZd dlZd dlmZmZ ddlmZ ddddd �gZ d
d� Z
dd
d�Zddd�Zed�dd� �Z
ed�ddd��Zdd� Zed�dd� �ZdS )� N)�plugin�plugin_function� )�generalz&Official MySQL Shell Plugin RepositoryzRThe official MySQL Shell Plugin Repository maintained by the MySQL Team at Oracle.z6https://cdn.mysql.com/mysql_shell/plugins_manifest.zipz*manifest/mysql-shell-plugins-manifest.json)�name�description�urlZmanifestPathc C sX d}d}| D ]F}||d�d|� dd�� d|� dd �� d|� d
d�� d�7 }|d7 }q|S )z�Returns a formatted list of repositories.
Args:
repositories (list): A list of repositories.
Returns:
The formated list as string
� r z>4� r z??z
r �-r z
��get)�repositories�out�i�r� r �G/usr/lib/mysqlsh/python-packages/mysqlsh/plugin_manager/repositories.py�format_repository_listing, s :
r Fc C s� t j�t�� d�}t j�|�r�z,t|d��}t�|�� d�}W 5 Q R X |W S tj
k
r� } z:td|� dt|j
�� d|j� d|j� �� | r�� W Y �dS d}~X Y q� tk
r� } z"td |� dt|�� �� | r҂ W 5 d}~X Y q�X ng S dS )
z�Fetches the registered user repositories
Args:
raise_exceptions (bool): Whether exceptions are raised
Returns:
The registered repositories as list
�plugin-repositories.jsonr r z"ERROR: Could not parse JSON file '�'.
�, line: �, col: NzERROR: Error reading file ')�os�path�joinr �get_shell_user_dir�isfile�open�json�loadr
�JSONDecodeError�print�str�msg�lineno�colno�OSError)�raise_exceptions�user_repo_file_path�user_repo_file�
user_repos�er r r �get_user_repositories@ s( �$�r- c
C s� dd| d�}t j�t�� d�}z,t|d��}tj||dd� W 5 Q R X W dS tk
r� } z(t d |� d
t
|�� �� |rz� W Y �dS d}~X Y nX dS )
z�Stores the registered user repositories
Args:
user_repos (list): The list of
raise_exceptions (bool): Whether exceptions are raised
Returns:
True on success
zMySQL Shell Plugin Repositoriesz0.0.1)ZfileType�versionr r �w� )�indentTzERROR: Error writing to file 'r FN)r r r r r r r �dumpr'