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__/temp_utils.cpython-39.pyc
a

��`z�@sjddlZddlZddlZddlZddlZdadZdZddd�Zdd�Z	ej
dd	d
��Zdd�Zd
d�Z
dS)�Nz/run/cloud-init/tmpz/var/tmp/cloud-initFcCs�|dur|S|r:t}tj�|�s6t�|�t�|d�|StrBtSt��dkrTt}ntj	�
dd�}tj�|�s�t�|�t�|d�|a|S)a%Return the proper 'dir' argument for tempfile functions.

    When root, cloud-init will use /run/cloud-init/tmp to avoid
    any cleaning that a distro boot might do on /tmp (such as
    systemd-tmpfiles-clean).

    If the caller of this function (mkdtemp or mkstemp) was provided
    with a 'dir' argument, then that is respected.

    @param odir: original 'dir' arg to 'mkdtemp' or other.
    @param needs_exe: Boolean specifying whether or not exe permissions are
        needed for tempdir. This is needed because /run is mounted noexec.
    Ni�rZTMPDIRz/tmp)�_EXE_ROOT_TMPDIR�os�path�isdir�makedirs�chmod�_TMPDIR�getuid�_ROOT_TMPDIR�environ�get)Zodir�	needs_exe�tdir�r�6/usr/lib/python3/dist-packages/cloudinit/temp_utils.py�_tempfile_dir_args$

rcsXt|�dd�|�dd��|d<tjfi|���dd�}|�_�fdd�}t�d|��S)	N�dirr
Fc
SsHzt�|�Wn4tyB}z|jtjkr.|�WYd}~n
d}~00dS�N)r�unlink�OSError�errno�ENOENT)r�errr�_unlink_if_exists>s
z0ExtendedTemporaryFile.<locals>._unlink_if_existscs���j�dSr)r�namer��fhrr�
unlink_nowLsz)ExtendedTemporaryFile.<locals>.unlink_nowr)r�pop�tempfileZNamedTemporaryFiler�setattr)�kwargsrrrrr�ExtendedTemporaryFile6s�r"c
ks<tfi|��}z|VWtj||d�ntj||d�0dS)N)�
ignore_errors)�mkdtemp�shutil�rmtree)Zrmtree_ignore_errorsr!rrrr�tempdirSsr'cKs.t|�dd�|�dd��|d<tjfi|��S�Nrr
F)rrrr$�r!rrrr$_s�r$cKs.t|�dd�|�dd��|d<tjfi|��Sr()rrr�mkstempr)rrrr*es�r*)NF)F)�
contextlibrrr%rrr
rrr"�contextmanagerr'r$r*rrrr�<module>s
(