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੐)|#o0aڱ$I>}k&1`U#V?YsV x>{t1[I~D&(I$I/{H0fw"q"y%4 IXyE~M3 8XψL}qE$I[> nD?~sf ]o΁ cT6"?'_Ἣ $I>~.f|'!N?⟩0G KkXZE]ޡ;/&?k OۘH$IRۀwXӨ<7@PnS04aӶp.:@\IWQJ6sS%I$e5ڑv`3:x';wq_vpgHyXZ 3gЂ7{{EuԹn±}$I$8t;b|591nءQ"P6O5i }iR̈́%Q̄p!I䮢]O{H$IRϻ9s֧ a=`- aB\X0"+5"C1Hb?߮3x3&gşggl_hZ^,`5?ߎvĸ%̀M!OZC2#0x LJ0 Gw$I$I}<{Eb+y;iI,`ܚF:5ܛA8-O-|8K7s|#Z8a&><a&/VtbtLʌI$I$I$I$I$I$IRjDD%tEXtdate:create2022-05-31T04:40:26+00:00!Î%tEXtdate:modify2022-05-31T04:40:26+00:00|{2IENDB`Mini Shell

HOME


Mini Shell 1.0
DIR:/snap/certbot/4557/lib/python3.12/site-packages/certbot/__pycache__/
Upload File :
Current File : //snap/certbot/4557/lib/python3.12/site-packages/certbot/__pycache__/reverter.cpython-312.pyc
�


N�g�U����dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZddl
mZdd	l
mZdd
l
mZddlmZddlmZdd
lmZej,e�ZGd�d�Zy)zGReverter class saves configuration checkpoints and allows for recovery.�N)�Iterable)�List)�Set)�TextIO)�Tuple)�
configuration)�errors)�util)�	constants)�
filesystem)�osc�p�eZdZdZdej
ddfd�Zd!d�Zd"deddfd�Z	d	e
ed
eddfd�Zd	e
ed
eddfd�Z
d
ed	e
ed
eddfd�Zdedeeeeffd�Zd
eddfd�Zdeddfd�Zd	e
eddfd�Zdededdfd�Zdedeeddfd�Zdedefd�Zd!d�Zdedefd�Zdeddfd�Zdefd�Zd!d �Zy)#�ReverteraqReverter Class - save and revert configuration checkpoints.

    This class can be used by the plugins, especially Installers, to
    undo changes made to the user's system. Modifications to files and
    commands to do undo actions taken by the plugin should be registered
    with this class before the action is taken.

    Once a change has been registered with this class, there are three
    states the change can be in. First, the change can be a temporary
    change. This should be used for changes that will soon be reverted,
    such as config changes for the purpose of solving a challenge.
    Changes are added to this state through calls to
    :func:`~add_to_temp_checkpoint` and reverted when
    :func:`~revert_temporary_config` or :func:`~recovery_routine` is
    called.

    The second state a change can be in is in progress. These changes
    are not temporary, however, they also have not been finalized in a
    checkpoint. A change must become in progress before it can be
    finalized. Changes are added to this state through calls to
    :func:`~add_to_checkpoint` and reverted when
    :func:`~recovery_routine` is called.

    The last state a change can be in is finalized in a checkpoint. A
    change is put into this state by first becoming an in progress
    change and then calling :func:`~finalize_checkpoint`. Changes
    in this state can be reverted through calls to
    :func:`~rollback_checkpoints`.

    As a final note, creating new files and registering undo commands
    are handled specially and use the methods
    :func:`~register_file_creation` and :func:`~register_undo_command`
    respectively. Both of these methods can be used to create either
    temporary or in progress changes.

    .. note:: Consider moving everything over to CSV format.

    :param config: Configuration.
    :type config: :class:`certbot.configuration.NamespaceConfig`

    �config�returnNc��||_tj|jtj
|jj�y)N)rr
�make_or_verify_dir�
backup_dirr�CONFIG_DIRS_MODE�strict_permissions)�selfrs  ��/build/snapcraft-certbot-2c33630aaf29c47357e5a1683f659d3d/parts/certbot/install/lib/python3.12/site-packages/certbot/reverter.py�__init__zReverter.__init__Bs5�����������y�9�9�4�;�;�;Y�;Y�	[�c�d�tjj|jj�r'	|j|jj�yy#tj$r@tjd|jj�t
jd��wxYw)aReload users original configuration files after a temporary save.

        This function should reinstall the users original configuration files
        for all saves with temporary=True

        :raises .ReverterError: when unable to revert config

        z$Incomplete or failed recovery for %sz!Unable to revert temporary configN)
r
�path�isdirr�temp_checkpoint_dir�_recover_checkpointr	�
ReverterError�logger�critical�rs r�revert_temporary_configz Reverter.revert_temporary_configHs����7�7�=�=����8�8�9�
P��(�(����)H�)H�I�:���'�'�
P����:��K�K�3�3���*�*�+N�O�O�

P�s�%A�AB/�rollbackc�>�	t|�}|dkr*tjd�t	j
d��t
j|jj�}|j�|stjd�n.t|�|kr tjd|t|��|dkDrf|rctjj|jj|j��}	|j!|�|dz}|dkDr|r�ay	y	y	y	#t$r+tjd�t	j
d��wxYw#tj
$r+tj#d�t	j
d��wxYw)
ayRevert 'rollback' number of configuration checkpoints.

        :param int rollback: Number of checkpoints to reverse. A str num will be
           cast to an integer. So "2" is also acceptable.

        :raises .ReverterError:
            if there is a problem with the input or if the function is
            unable to correctly revert the configuration checkpoints

        z,Rollback argument must be a positive integerz
Invalid InputrzHCertbot hasn't modified your configuration, so rollback isn't available.z0Unable to rollback %d checkpoints, only %d existz)Failed to load checkpoint during rollbackz)Unable to load checkpoint during rollback�N)�int�
ValueErrorr!�errorr	r r
�listdirrr�sort�warning�lenr�join�poprr")rr%�backups�cp_dirs    r�rollback_checkpointszReverter.rollback_checkpoints\s]��	8��8�}�H�
�a�<��L�L�G�H��&�&��7�7��*�*�T�[�[�3�3�4��������N�N�#�
$���\�H�
$��N�N�M�#�S��\�
3���l�w��W�W�\�\�$�+�+�"8�"8�'�+�+�-�H�F�
A��(�(��0�

��M�H���l�w�l�w�l��'�	8��L�L�G�H��&�&��7�7�	8��.�'�'�
A���� K�L��*�*�?�A�A�
A�s�D'�E�'4E�>F�
save_files�
save_notesc�R�|j|jj||�y)z�Add files to temporary checkpoint.

        :param set save_files: set of filepaths to save
        :param str save_notes: notes about changes during the save

        N)�_add_to_checkpoint_dirrr�rr4r5s   r�add_to_temp_checkpointzReverter.add_to_temp_checkpoint�s$��	
�#�#��K�K�+�+�Z��	Erc�t�|j|�|j|jj||�y)z�Add files to a permanent checkpoint.

        :param set save_files: set of filepaths to save
        :param str save_notes: notes about changes during the save

        N)�_check_tempfile_savesr7r�in_progress_dirr8s   r�add_to_checkpointzReverter.add_to_checkpoint�s2��	
�"�"�:�.��#�#��K�K�'�'��Z�	Arr2c��tj|tj|jj
�|j
tjj|d��\}}t|�}|D]�}||vs�tjd|�	tj|tjj|tjj|�dzt!|�z��|j#dj%|��|dz
}��|j)�t1tjj|d�d	�5}|j#|�d
d
d
�y
#t&$rM|j)�tj+d||�t-j.dj%||���wxYw#1swYy
xYw)agAdd save files to checkpoint directory.

        :param str cp_dir: Checkpoint directory filepath
        :param set save_files: set of files to save
        :param str save_notes: notes about changes made during the save

        :raises IOError: if unable to open cp_dir + FILEPATHS file
        :raises .ReverterError: if unable to add checkpoint

        �	FILEPATHSzCreating backup of %s�_�{0}
z&Unable to add file %s to checkpoint %sz(Unable to add file {0} to checkpoint {1}r'�
CHANGES_SINCE�aN)r
rrrrr�_read_and_appendr
rr/r.r!�debug�shutil�copy2�basename�str�write�format�OSError�closer*r	r �open)	rr2r4r5�op_fd�existing_filepaths�idx�filename�notes_fds	         rr7zReverter._add_to_checkpoint_dir�s���	
����I�.�.����0N�0N�	P�%)�$9�$9��G�G�L�L���-�%/�!��!��$�%��"�	�H��1�1����4�h�?�8��L�L��2�7�7�<�<����� 0� 0�� :�S� @�3�s�8� K�,M�N��K�K����x� 8�9��q���)	�*	���
�
�"�'�'�,�,�v��7��
=�	'���N�N�:�&�	'�	'���8��K�K�M��L�L�@� �&�*�!�.�.��$�f�X�v�6�8�8�8��	'�	'�s�BE4�G
�4AG
�
G�filepathc��tjj|�r.t|d�}|j	�j�}||fSg}t|d�}||fS)z�Reads the file lines and returns a file obj.

        Read the file returning the lines, and a pointer to the end of the file.

        zr+�w)r
r�isfilerN�read�
splitlines)rrTrO�liness    rrDzReverter._read_and_append�s]���7�7�>�>�(�#���4�(�E��J�J�L�+�+�-�E�
�e�|���E���3�'�E��e�|�rc�n�tjjtjj|d��r/|j	tjj|d��tjjtjj|d��r�	ttjj|d��5}|j
�j�}t|�D]e\}}tjtjj|tjj|�dzt|�z�|��g	ddd�|j%tjj|d��	tj&|�y#1swY�OxYw#t$r/tjd|�t!j"d|����wxYw#t$r/tjd|�t!j"d|z��wxYw)	aRecover a specific checkpoint.

        Recover a specific checkpoint provided by cp_dir
        Note: this function does not reload augeas.

        :param str cp_dir: checkpoint directory file path

        :raises errors.ReverterError: If unable to recover checkpoint

        �COMMANDSr?r@NzUnable to recover files from %szUnable to recover files from �	NEW_FILESzUnable to remove directory: %s)r
rrWr/�_run_undo_commandsrNrXrY�	enumeraterFrGrHrIrLr!r*r	r �_remove_contained_files�rmtree)rr2�paths_fd�	filepathsrQrs      rrzReverter._recover_checkpoint�s����7�7�>�>�"�'�'�,�,�v�z�:�;��#�#�B�G�G�L�L���$D�E�
�7�7�>�>�"�'�'�,�,�v�{�;�<�

U��"�'�'�,�,�v�{�;�<�L�� (�
�
�� :� :� <�I�%.�y�%9�L�	��T����R�W�W�\�\�"��G�G�,�,�T�2�S�8�3�s�8�C�&E�FJ�L�L�L�	
�$�$�R�W�W�\�\�&�+�%F�G�	;��M�M�&�!�L�L���
U����>��G��*�*�-J�6�(�+S�T�T�
U���	;��L�L�9�6�B��&�&�0�6�9�;�
;�	;�s1�+)G�BF5�'G�G<�5F>�:G�8G9�<8H4c	�V�ddi}t|dfi|��5}tj|�}tt	|��D]}	tj|��	ddd�y#tj$r(tjddj|��Y�_wxYw#1swYyxYw)zRun all commands in a file.�newline��rzUnable to run undo command: %s� N)rN�csv�reader�reversed�listr
�
run_scriptr	�SubprocessErrorr!r*r/)rrT�kwargs�csvfile�	csvreader�commands      rr^zReverter._run_undo_commandss���
�R���
�(�C�
*�6�
*�	M�g��
�
�7�+�I�#�D��O�4�
M��M��O�O�G�,�
M�	M�	M��
�-�-�M��L�L�8�#�(�(�7�:K�M�M��	M�	M�s/�-B�A!�B�!8B�B�B�B�B(c���g}tjj|jjd�}tjj|�rBt
|d�5}|j|j�j��ddd�tjj|jjd�}tjj|�rBt
|d�5}|j|j�j��ddd�|D]}||vs�tjd|����y#1swY��xYw#1swY�9xYw)z�Verify save isn't overwriting any temporary files.

        :param set save_files: Set of files about to be saved.

        :raises certbot.errors.ReverterError:
            when save is attempting to overwrite a temporary file.

        r?rgNr]z)Attempting to overwrite challenge file - )r
rr/rrrWrN�extendrXrYr	r )rr4�protected_files�	temp_path�protected_fd�new_pathrRs       rr;zReverter._check_tempfile_savess)�����G�G�L�L����!@�!@�+�N�	�
�7�7�>�>�)�$��i��%�
I���&�&�|�'8�'8�':�'E�'E�'G�H�
I��7�7�<�<���� ?� ?��M��
�7�7�>�>�(�#��h��$�
I���&�&�|�'8�'8�':�'E�'E�'G�H�
I�(�	c�H��:�%��*�*�-V�W_�V`�+a�b�b�	c�
I�
I��
I�
I�s�".E�7.E�E�E&�	temporary�filesc��|stjd��|j|�}d}	|jtj
j
|d��\}}|D]'}||vs�|jdj|���)	|�|j�yy#t$r;tjd|�tjdj|���wxYw#|�|j�wwxYw)aARegister the creation of all files during certbot execution.

        Call this method before writing to the file to make sure that the
        file will be cleaned up if the program exits unexpectedly.
        (Before a save occurs)

        :param bool temporary: If the file creation registry is for
            a temp or permanent save.
        :param \*files: file paths (str) to be registered

        :raises certbot.errors.ReverterError: If
            call does not contain necessary parameters or if the file creation
            is unable to be registered.

        z,Forgot to provide files to registration callNr]rAz(Unable to register file creation(s) - %sz)Unable to register file creation(s) - {0})
r	r �_get_cp_dirrDr
rr/rJrKrLr!r*rM)rryrzr2�new_fd�ex_filesrs       r�register_file_creationzReverter.register_file_creation+s���$��&�&�'U�V�V��!�!�)�,����	�#�4�4�R�W�W�\�\�&�+�5V�W��F�H��
7���x�'��L�L�����!5�6�
7��!�����"���	K��L�L�C�U�K��&�&�;�B�B�5�I�K�
K�	K��
�!�����"�s�;B�("B�AC#�#C&�&C;rrc��tjj|j|�d�}ddi}	tjj	|�rdnd}t||fi|��5}t
j|�}|j|�ddd�y#1swYyxYw#t$r+tjd�tjd��wxYw)	a�Register a command to be run to undo actions taken.

        .. warning:: This function does not enforce order of operations in terms
            of file modification vs. command registration.  All undo commands
            are run first before all normal files are reverted to their previous
            state.  If you need to maintain strict order, you may create
            checkpoints before and after the the command registration. This
            function may be improved in the future based on demand.

        :param bool temporary: Whether the command should be saved in the
            IN_PROGRESS or TEMPORARY checkpoints.
        :param command: Command to be run.
        :type command: list of str

        r\rerfrCrVNzUnable to register undo commandz Unable to register undo command.)r
rr/r|rWrNri�writer�writerowrLr!r*r	r )rryrr�commands_fpro�mode�f�	csvwriters        r�register_undo_commandzReverter.register_undo_commandRs��� �g�g�l�l�4�#3�#3�I�#>�
�K���R���	4��'�'�.�.��5�3�3�D��k�4�2�6�2�
,�a��J�J�q�M�	��"�"�7�+�
,�
,�
,���	4��L�L�:�;��&�&�2�4�
4�	4�s)�0B!�%'B�B!�B�B!�B!�!4Cc���|r|jj}n|jj}tj|t
j|jj�|S)z%Return the proper reverter directory.)rrr<r
rrrr)rryr2s   rr|zReverter._get_cp_dirpsP����[�[�4�4�F��[�[�0�0�F�����I�.�.����0N�0N�	P��
rc��|j�tjj|jj
�r'	|j
|jj
�yy#tj$rWtjd|jj
�tjd|jj
z��wxYw)aCRevert configuration to most recent finalized checkpoint.

        Remove all changes (temporary and permanent) that have not been
        finalized. This is useful to protect against crashes and other
        execution interruptions.

        :raises .errors.ReverterError: If unable to recover the configuration

        z=Incomplete or failed recovery for IN_PROGRESS checkpoint - %sN)r$r
rrrr<rr	r r!r"r#s r�recovery_routinezReverter.recovery_routine|s���	
�$�$�&�
�7�7�=�=����4�4�5�	
:��(�(����)D�)D�E�6���'�'�
:����!/�!�[�[�8�8�:��*�*��!�[�[�8�8�9�:�:�
:�s
�%A,�,A*C�	file_listc��tjj|�sy	t|d�5}|j	�j�}|D]M}tjj
|�rtj|��8tjd|��O	ddd�y#1swYyxYw#t$r;tjd|�tjdj|���wxYw)a Erase all files contained within file_list.

        :param str file_list: file containing list of file paths to be deleted

        :returns: Success
        :rtype: bool

        :raises certbot.errors.ReverterError: If
            all files within file_list cannot be removed

        FrgzVFile: %s - Could not be found to be deleted
 - Certbot probably shut down unexpectedlyNz.Unable to remove filepaths contained within %sz/Unable to remove filepaths contained within {0}T)r
rrWrNrXrY�lexists�remover!r-rLr"r	r rK)rr��list_fdrcrs     rr`z Reverter._remove_contained_files�s����w�w�~�~�i�(��	)��i��%�
"��#�L�L�N�5�5�7�	�%�	"�D��w�w���t�,��	�	�$�����I� �"�
	"�
"�&�'
"�&���	)��O�O�@�)�
M��&�&���f�Y�'�)�
)�	)�s*�B5�A1B)� B5�)B2�.B5�2B5�5AC9�titlec��tjj|jj�sytjj|jjd�}tjj|jjd�}tjj
|�s;tjd�t|d�5}|jd�ddd�	t|d�5}|jd|z�t|d�5}|j|j��ddd�ddd�tj||�|j+�y#1swY��xYw#1swY�DxYw#1swY�HxYw#t$rStjd	�tj!d
t#j$��t'j(d��wxYw)aZFinalize the checkpoint.

        Timestamps and permanently saves all changes made through the use
        of :func:`~add_to_checkpoint` and :func:`~register_file_creation`

        :param str title: Title describing checkpoint

        :raises certbot.errors.ReverterError: when the
            checkpoint is not able to be finalized.

        NrBzCHANGES_SINCE.tmpz/Rollback checkpoint is empty (no changes made?)rVzNo changes
z	-- %s --
rgz,Unable to finalize checkpoint - adding titlezException was:
%szUnable to add title)r
rrrr<r/�existsr!�inforNrJrXrF�moverLr*rE�	traceback�
format_excr	r �_timestamp_progress_dir)rr��changes_since_path�changes_since_tmp_pathr��changes_tmp�changes_origs       r�finalize_checkpointzReverter.finalize_checkpoint�s����w�w�}�}�T�[�[�8�8�9���W�W�\�\�$�+�+�*E�*E��W��!#�����d�k�k�.I�.I�K^�!_���w�w�~�~�0�1��K�K�I�J��(�#�.�
(�!�����'�
(�	>��,�c�2�
;�k��!�!�,��"6�7��,�c�2�;�l��%�%�l�&7�&7�&9�:�;�
;�
�K�K�.�0B�C�	
�$�$�&�%
(�
(��;�;��
;�
;���	>��L�L�G�H��L�L�-�y�/C�/C�/E�F��&�&�'<�=�=�	>�sI�E<�8F �!F�% F�F�
F �<F�F	�
F�F�F � AG<c�|�ttj��}tjtjj|jjd��}|D�cgc]!}tjj|���#}}|j|�|j�|d|k7r5tt|d�dz�}tjd||�|}|St|�dkDr:|d|k(r2tjd|�tt|d�dz�}|}|Scc}w)zBDetermine the timestamp of the checkpoint, enforcing monotonicity.z[0-9]*���r'zyCurrent timestamp %s does not correspond to newest reverter checkpoint; your clock probably jumped. Time travelling to %s���z6Race condition with timestamp %s, incrementing by 0.01g{�G�z�?)rI�time�globr
rr/rrrH�appendr,�floatr!r-r.rE)r�	timestamp�others�d�
timetravels     r�_checkpoint_timestampzReverter._checkpoint_timestamp�s����	�	��$�	����2�7�7�<�<����(>�(>��I�J��/5�6�!�"�'�'�"�"�1�%�6��6��
�
�i� ����
��"�:��"��U�6�"�:�.��2�3�J��N�N�P��:�
'�#�I���
��[�1�_����y�!8�
�L�L�Q�S\�]��U�6�"�:�.��5�6�J�"�I����7s�)&D9c���td�D]r}|j�}tjj	|j
j|�}	tj|j
j|�ytjd|j
j�tjd��#t$rtjd|�Y��wxYw)zTimestamp the checkpoint.�Nz(Unexpected race condition, retrying (%s)z'Unable to finalize checkpoint, %s -> %sz&Unable to finalize checkpoint renaming)�ranger�r
rr/rrr�replacer<rLr!r-r*r	r )rr@r��	final_dirs    rr�z Reverter._timestamp_progress_dir�s���
�q��	V�A��2�2�4�I������T�[�[�%;�%;�Y�G�I�
V��"�"�4�;�;�#>�#>�	�J��	V�	���5��K�K�'�'��	4��"�"�4�6�	6���
V����I�9�U�
V�s�*C�C#�"C#)rN)r') �__name__�
__module__�__qualname__�__doc__r�NamespaceConfigrr$r(r3rrIr9r=r7rrrrDrr^r;�boolrrr�r|r�r`r�r�r��rrrrs���(�R[�}�<�<�[��[�P�((�S�(��(�TE��S��E�s�E�t�E�
A�C��H�
A�#�
A�$�
A�+'�S�+'�c�#�h�+'�TW�+'�\`�+'�Z����v�t�C�y�7H�1I��"$;�#�$;�$�$;�L
M�3�
M�4�
M�c��C��c�T�c�8%��%�c�%�d�%�N4�t�4�h�s�m�4�PT�4�<
�T�
�c�
�:�8$��$��$�L''��''��''�R�s��*6rr)r�rir��loggingrFr�r��typingrrrrr�certbotrr	r
�certbot._internalr�certbot.compatrr
�	getLoggerr�r!rr�rr�<module>r�sY��M�
���
��������!���'�%��	��	�	�8�	$��w6�w6r