HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //proc/self/root/lib/python3/dist-packages/cloudinit/__pycache__/atomic_helper.cpython-310.pyc
o

�Ad��@sVddlZddlZddlZddlZddlZdZe�e�Zeddfdd�Z	efdd�Z
dS)	�Ni��wbFc
Cs�|rz
t�|�}t�|j�}Wn	tyYnwd}z3tjtj�|�d|d�}t	�
d||j||t|��|�
|�|��t�|j|�t�|j|�WdStyf}z|dur`t�|j�|�d}~ww)NF)�dir�delete�modezOAtomically writing to file %s (via temporary file %s) - %s: [%o] %d bytes/chars)�os�stat�S_IMODE�st_mode�OSError�tempfile�NamedTemporaryFile�path�dirname�LOG�debug�name�len�write�close�chmod�rename�	Exception�unlink)�filename�contentr�omode�
preserve_mode�	file_stat�tf�e�r �9/usr/lib/python3/dist-packages/cloudinit/atomic_helper.py�
write_file
s<
���
	��r"cCs t|tj|ddd�dd|d�S)N�T)�indent�	sort_keys�
�w)rr)r"�json�dumps)r�datarr r r!�
write_json1s�r+)r(�loggingrrr�
_DEF_PERMS�	getLogger�__name__rr"r+r r r r!�<module>s

�$