HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991111/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Current File : //proc/1991111/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/gpg.cpython-311.pyc
�

܍~cH��|�dZddlZddlmZddlmZeje��Zgd�Z	d�Z
d�Zdd	�Zdd�Z
d�Zdd�ZdS)z0gpg.py - Collection of gpg key related functions�N)�log)�subp)�gpgz--with-fingerprintz--no-default-keyringz--list-keysz	--keyringc��	tjddd|gd���\}}n:#tj$r(}t�d||��d}Yd}~nd}~wwxYw|S)z*Export gpg key, armoured key gets returnedrz--exportz--armourT��capture�&Failed to export armoured key "%s": %sN)r�ProcessExecutionError�LOG�debug)�key�armour�_�errors    �//usr/lib/python3/dist-packages/cloudinit/gpg.py�
export_armourrs�����i�
�J�
�C�0�$�
�
�
�������%�����	�	�:�C��G�G�G�����������������Ms� �A�A�Ac�>�tjddg|d���jS)z~Dearmor gpg key, dearmored key gets returned

    note: man gpg(1) makes no mention of an --armour spelling, only --armor
    rz	--dearmorF)�data�decode)r�stdout)r
s r�dearmorr's#��
�9�e�[�)��E�B�B�B�I�I�Fc��g}|�t��|s|�d��|�|��tj|d���\}}|rt�d||��|S)z�List keys from a keyring with fingerprints. Default to a stable machine
    parseable format.

    @param key_file: a string containing a filepath to a key
    @param human_output: return output intended for human parsing
    z
--with-colonsTrr	)�extend�GPG_LIST�appendrr�warning)�key_file�human_output�cmdr�stderrs     r�listr"/s���
�C��J�J�x�����$��
�
�?�#�#�#��J�J�x�����y��d�3�3�3��V�V�
�P����<�h��O�O�O��Mr��r$c��t�d||��ddd|zd|g}|�g}d}d}t|��}	|d	z
}	tj|d�
��t�d|||��dS#tj$r}|}Yd}~nd}~wwxYw	t|��}t�d|j|��tj|��n)#t$r}td
||||fz��|�d}~wwxYw��)a�Receive gpg key from the specified keyserver.

    Retries are done by default because keyservers can be unreliable.
    Additionally, there is no way to determine the difference between
    a non-existant key and a failure.  In both cases gpg (at least 2.2.4)
    exits with status 2 and stderr: "keyserver receive failed: No data"
    It is assumed that a key provided to cloud-init exists on the keyserver
    so re-trying makes better sense than failing.

    @param key: a string key fingerprint (as passed to gpg --recv-keys).
    @param keyserver: the keyserver to request keys from.
    @param retries: an iterable of sleep lengths for retries.
                    Use None to indicate no retries.z&Importing key '%s' from keyserver '%s'rz--no-ttyz--keyserver=%sz--recv-keysNrTr$rz/Imported key '%s' from keyserver '%s' on try %dz6Import failed with exit code %d, will try again in %ssz@Failed to import key '%s' from keyserver '%s' after %d tries: %s)rr�iterrr
�next�	exit_code�time�sleep�
StopIteration�
ValueError)	r
�	keyserver�retriesr �trynumr�sleeps�e�naplens	         r�recv_keyr3Bsj���I�I�6��Y�G�G�G��*�.��:�M�3�
O�C�����
�F��E�
�'�]�]�F���!���
	��I�c�4�(�(�(�(��I�I�A����	
�
�
�
�F���)�	�	�	��E�E�E�E�E�E�����	����	��&�\�\�F��I�I�H����
�
�
�

�J�v�������	�	�	��%�(+�Y���'F�G����
�����	����+s1�3A:�:B�	B�B�AC�
D�(C?�?Dc��	tjdddd|gd���dS#tj$r'}t�d||��Yd}~dSd}~wwxYw)	z0Delete the specified key from the local gpg ringrz--batchz--yesz
--delete-keysTrzFailed delete key "%s": %sN)rr
rr)r
rs  r�
delete_keyr5ss���>��	�
�I�w���=�t�	
�	
�	
�	
�	
�	
���%�>�>�>����0�#�u�=�=�=�=�=�=�=�=�=�����>���s��A�A�A�keyserver.ubuntu.comc�
�t|��}|sq	t||���t|��}n*#t$rt�d|���wxYw	t|��n#t|��wxYw|S)zget gpg keyid from keyserver)r-zFailed to obtain gpg key %s)rr3r,r�	exceptionr5)�keyidr-rs   r�
getkeybyidr:}s���
�5�
!�
!�F��	�	��U�i�0�0�0�0�"�5�)�)�F�F���	�	�	��M�M�7��?�?�?��	����
�
�u������J�u���������Ms� 4�A/�'A�A/�/B)F)r#)r6)�__doc__r)�	cloudinitr�loggingr�	getLogger�__name__rrrrr"r3r5r:�rr�<module>rAs���7�6�����$�$�$�$�$�$��������g���!�!������
�
�
�J�J�J�����&.�.�.�.�b>�>�>������r