%PDF- %PDF-
Direktori : /usr/lib/python3/dist-packages/certbot/plugins/__pycache__/ |
Current File : //usr/lib/python3/dist-packages/certbot/plugins/__pycache__/storage.cpython-312.pyc |
� M/�e� � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddl mZ ej e � Z G d � d � Zy)zPlugin storage class.� N)�Any)�Dict)� configuration)�errors)� filesystem)�osc �t � e Zd ZdZdej deddfd�Zdd�Zdd�Z dd �Z d ededdfd�Zd edefd �Z y)� PluginStoragez4Class implementing storage functionality for plugins�config�classkey�returnNc �6 � || _ || _ d| _ | | y)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)�selfr r s �9/usr/lib/python3/dist-packages/certbot/plugins/storage.py�__init__zPluginStorage.__init__ s � � ���!���!����� c � � t j j | j j d� | _ | j � d| _ y)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 )r s r �_initialize_storagez!PluginStorage._initialize_storage! s7 � � �G�G�L�L����)@�)@�BW�X���� � �� ��r c �� � i }d} t | j d� 5 }|j � }ddd� t j |� }|| _ y# 1 sw Y �'xY w# t $ r�}dj | j t |� � }t j j | j � r*t j |� t j |� �Y d}~��d}~ww xY w# t $ rr |s!t j! d| j � nEdj | j � }t j |� t j |� �Y || _ yw xY w)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�strr r �isfile�logger�errorr �PluginStorageError�json�loads� ValueError�debug�_data)r �data�filedata�fh�e�errmsgs r r zPluginStorage._load) s9 � � "���� 8��d�'�'��-� %���7�7�9�� %� 8��:�:�h�'�D� �� �) %� %��� 8�H�O�O��!�!�3�q�6�+�F��w�w�~�~�d�/�/�0����V�$��/�/��7�7� 1�� 8�� � 8�����Q�!�.�.�0� @�F�F��%�%�'�����V�$��/�/��7�7� 0� �� � 8�s@ �A �A�A �C- �A�A � C*�(A8C%�%C*�-A1E(�'E(c �6 � | j s,d}t j |� t j |� � t j | j � } t j t j | j t j t j"