• File: storage.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/lib/python2.7/site-packages/certbot/plugins/storage.pyc
  • Date Modified: 10/08/2021 7:08 AM
  • File size: 4.57 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

_c@sdZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ejeZ
defd	YZdS(
sPlugin storage class.iN(tAny(tDict(terrors(t
filesystem(tost
PluginStoragecBsDeZdZdZdZdZdZdZdZRS(s4Class implementing storage functionality for pluginscCs1||_||_t|_d|_d|_dS(sInitializes 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

        N(t_configt	_classkeytFalset_initializedtNonet_datat_storagepath(tselftconfigtclasskey((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pyt__init__s
					cCs5tjj|jjd|_|jt|_dS(shInitializes PluginStorage data and reads current state from the disk
        if the storage json exists.s.pluginstorage.jsonN(	RtpathtjoinRt
config_dirRt_loadtTrueR	(R
((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pyt_initialize_storage s
cCsi}d}y+t|jd}|j}WdQXWnbtk
r}dj|jt|}tjj|jrt	j
|tj|qnXyt
j|}Wn[tk
r|st	jd|jq
dj|j}t	j
|tj|nX||_dS(sReads PluginStorage content from the disk to a dict structure

        :raises .errors.PluginStorageError: when unable to open or read the file
        ttrNs1Could not read PluginStorage data file: {0} : {1}s2Plugin storage file %s was empty, no values loadeds$PluginStorage file {0} is corrupted.(topenRtreadtIOErrortformattstrRRtisfiletloggerterrorRtPluginStorageErrortjsontloadst
ValueErrortdebugR(R
tdatatfiledatatfhteterrmsg((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pyR(s,

	

cCs+|js.d}tj|tj|nytj|j}WnDtk
r}dj	t
|}tj|tj|nXyOtjt
j|jtjtjBtjBdd}|j|WdQXWnJtk
r&}dj	|jt
|}tj|tj|nXdS(sSaves PluginStorage content to disk

        :raises .errors.PluginStorageError: when unable to serialize the data
            or write it to the filesystem
        s;Unable to save, no values have been added to PluginStorage.s+Could not serialize PluginStorage data: {0}itwNs4Could not write PluginStorage data to file {0} : {1}(R	RR RR!R"tdumpsRt	TypeErrorRRRtfdopenRRRtO_WRONLYtO_CREATtO_TRUNCtwriteR(R
R*t
serializedR)R(((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pytsaveFs,	


cCsS|js|jn|j|jkr;i|j|j<n||j|j|<dS(sPut configuration value to PluginStorage

        :param str key: Key to store the value to
        :param value: Data to store
        N(R	RRR(R
tkeytvalue((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pytputds
	
cCs(|js|jn|j|j|S(sGet 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
        (R	RRR(R
R5((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pytfetchqs	
(	t__name__t
__module__t__doc__RRRR4R7R8(((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pyRs					
(R;R"tloggingtacme.magic_typingRRtcertbotRtcertbot.compatRRt	getLoggerR9RtobjectR(((s;/usr/lib/python2.7/site-packages/certbot/plugins/storage.pyt<module>s