HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/__pycache__/atomic_helper.cpython-39.pyc
a

��`T�@sVddlZddlZddlZddlZddlZdZe�e�Zeddfdd�Z	efdd�Z
dS)	�Ni��wbFc
Cs�|r2zt�|�}t�|j�}Wnty0Yn0d}zdtjtj�|�d|d�}t	�
d||j||t|��|�
|�|��t�|j|�t�|j|�Wn<ty�}z$|dur�t�|j�|�WYd}~n
d}~00dS)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_statZtf�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�datarrrr �
write_json*s�r*)r'�loggingrrrZ
_DEF_PERMS�	getLogger�__name__rr!r*rrrr �<module>s
�