HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/__pycache__/temp_utils.cpython-310.pyc
o

x[h��@s�ddlZddlZddlZddlZddlZddlZddlmZe�e	�Z
dZdZdde
fdd�Zdde
fd	d
�Zdd�Zejdd
d��Zdde
fdd�Zdde
fdd�ZdS)�N)�utilz/run/cloud-init/tmpz/var/tmp/cloud-initF�	needs_execCs2|dur|S|r
tSt��dkrtStj�dd�S)Nr�TMPDIRz/tmp)�_EXE_ROOT_TMPDIR�os�getuid�_ROOT_TMPDIR�environ�get)�odirr�r�6/usr/lib/python3/dist-packages/cloudinit/temp_utils.py�get_tmp_ancestorsrcCsLt||�}tj�|�st�|�t�|d�|r$t�|d�r$t�	d|�|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.
    i��noexeczDRequested temporal dir with exe permission `%s` is mounted as noexec)
rr�path�isdir�makedirs�chmodr�
has_mount_opt�LOG�warning)rr�tdirrrr
�_tempfile_dir_args

�rcsDt�|d<tjdi|���dd�}|�_�fdd�}t�d|��S)N�dirc
SsHzt�|�WdSty#}z|jtjkr|�WYd}~dSd}~ww�N)r�unlink�OSError�errno�ENOENT)r�errr
�_unlink_if_exists?s���z0ExtendedTemporaryFile.<locals>._unlink_if_existscs���j�dSr)r�namer��fhrr
�
unlink_nowMsz)ExtendedTemporaryFile.<locals>.unlink_nowr$r)r�tempfile�NamedTemporaryFiler�setattr)�kwargsr r$rr"r
�ExtendedTemporaryFile8s
r)c
ks<�tdi|��}z
|VWtj||d�dStj||d�w)N)�
ignore_errorsr)�mkdtemp�shutil�rmtree)�rmtree_ignore_errorsr(rrrr
�tempdirTs
�"r/cK�t||�}tjdd|i|��S�Nrr)rr%r+�rrr(rrr
r+`�
r+cKr0r1)rr%�mkstempr2rrr
r4er3r4)NF)F)�
contextlibr�loggingrr,r%�	cloudinitr�	getLogger�__name__rrr�boolrrr)�contextmanagerr/r+r4rrrr
�<module>s"