HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/root/lib/python3/dist-packages/certbot/plugins/__pycache__/
Upload File :
Current File : //proc/1784574/root/lib/python3/dist-packages/certbot/plugins/__pycache__/storage.cpython-311.pyc
�

E��c����dZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
ddl	mZeje
��ZGd	�d
��ZdS)zPlugin storage class.�N)�Any)�Dict)�
configuration)�errors)�
filesystem)�osc�l�eZdZdZdejdeddfd�Zdd�Zdd�Z	dd	�Z
d
ededdfd�Zd
edefd
�Z
dS)�
PluginStoragez4Class implementing storage functionality for plugins�config�classkey�returnNc�8�||_||_d|_||dS)z�Initializes PluginStorage object storing required configuration
        options.

        :param .configuration.NamespaceConfig config: Configuration object
        :param str classkey: class name to use as root key in storage file

        FN)�_config�	_classkey�_initialized)�selfrrs   �9/usr/lib/python3/dist-packages/certbot/plugins/storage.py�__init__zPluginStorage.__init__s,�����!���!���������c��tj�|jjd��|_|���d|_dS)zhInitializes PluginStorage data and reads current state from the disk
        if the storage json exists.z.pluginstorage.jsonTN)r�path�joinr�
config_dir�_storagepath�_loadr)rs r�_initialize_storagez!PluginStorage._initialize_storage!s=���G�L�L���)@�BW�X�X����
�
���� ����rc���i}d}	t|jd��5}|���}ddd��n#1swxYwYn�#t$r�}d�|jt|����}tj�|j��r.t�
|��tj|���Yd}~nd}~wwxYw	tj|��}n{#t$rn|s!t�d|j��nHd�|j��}t�
|��tj|���YnwxYw||_dS)z�Reads PluginStorage content from the disk to a dict structure

        :raises .errors.PluginStorageError: when unable to open or read the file
        ��rNz1Could not read PluginStorage data file: {0} : {1}z2Plugin storage file %s was empty, no values loadedz$PluginStorage file {0} is corrupted.)�openr�read�IOError�format�strrr�isfile�logger�errorr�PluginStorageError�json�loads�
ValueError�debug�_data)r�data�filedata�fh�e�errmsgs      rrzPluginStorage._load)s���
 "����		8��d�'��-�-�
%���7�7�9�9��
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%����	8�	8�	8�H�O�O��!�3�q�6�6�+�+�F��w�~�~�d�/�0�0�
8����V�$�$�$��/��7�7�7�
8�
8�
8�
8�
8�����	8����
	8��:�h�'�'�D�D���	8�	8�	8��
8����Q�!�.�0�0�0�0�@�F�F��%�'�'�����V�$�$�$��/��7�7�7�
0�0�	8������
�
�
sK�A�<�A�A�A�A�A�
C�A:C�C�C/�/A5E'�&E'c�@�|js0d}t�|��tj|���	tj|j��}nb#t$rU}d�	t|����}t�|��tj|���d}~wwxYw	tjtj|jtjtjztjzd��d��5}|�|��ddd��dS#1swxYwYdS#t($r[}d�	|jt|����}t�|��tj|���d}~wwxYw)z�Saves PluginStorage content to disk

        :raises .errors.PluginStorageError: when unable to serialize the data
            or write it to the filesystem
        z;Unable to save, no values have been added to PluginStorage.z+Could not serialize PluginStorage data: {0}Ni��wz4Could not write PluginStorage data to file {0} : {1})rr&r'rr(r)�dumpsr-�	TypeErrorr#r$r�fdopenrr r�O_WRONLY�O_CREAT�O_TRUNC�writer")rr2�
serializedr1r0s     r�savezPluginStorage.saveGs���� �	4�R�F��L�L�� � � ��+�F�3�3�3�	4���D�J�/�/�J�J���	4�	4�	4�B�I�I��A�����F��L�L�� � � ��+�F�3�3�3�����		4����

	4���:�?��%��K�"�*�,�r�z�9���� �!�!�
%�%'�����$�$�$�	
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%�
%�
%��
�	4�	4�	4�K�R�R��!�3�q�6�6�+�+�F��L�L�� � � ��+�F�3�3�3�����		4���sV�A�
B2�AB-�-B2�6AD8�D+�D8�+D/�/D8�2D/�3D8�8
F�AF�F�key�valuec��|js|���|j|jvri|j|j<||j|j|<dS)z�Put configuration value to PluginStorage

        :param str key: Key to store the value to
        :param value: Data to store
        N)rrrr-)rr>r?s   r�putzPluginStorage.putesW��� �	'��$�$�&�&�&��>���+�+�)+�D�J�t�~�&�*/��
�4�>�"�3�'�'�'rc�h�|js|���|j|j|S)z�Get configuration value from PluginStorage

        :param str key: Key to get value from the storage

        :raises KeyError: If the key doesn't exist in the storage
        )rrr-r)rr>s  r�fetchzPluginStorage.fetchrs5��� �	'��$�$�&�&�&��z�$�.�)�#�.�.r)r
N)�__name__�
__module__�__qualname__�__doc__r�NamespaceConfigr$rrrr=rrArC�rrr
r
s�������>�>�
�}�<�
��
�PT�
�
�
�
�!�!�!�!�����<4�4�4�4�<0�s�0�3�0�4�0�0�0�0�
/��
/��
/�
/�
/�
/�
/�
/rr
)rGr)�logging�typingrr�certbotrr�certbot.compatrr�	getLoggerrDr&r
rIrr�<module>rOs�������������������������!�!�!�!�!�!�������%�%�%�%�%�%�������	��	�8�	$�	$��m/�m/�m/�m/�m/�m/�m/�m/�m/�m/r