+
    i                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ]P                  ! ]	4      t
RtRtRR R lltRR R lltR	 t] P                   RR
 l4       tRR R lltRR R lltR# )    N)utilz/run/cloud-init/tmpz/var/tmp/cloud-initc                $    V ^8  d   QhR\         /#    	needs_exebool)formats   "6/usr/lib/python3/dist-packages/cloudinit/temp_utils.py__annotate__r      s     , ,4 ,    c                     V e   V # V'       d   \         # \        P                  ! 4       ^ 8X  d   \        # \        P                  P                  RR4      # )NTMPDIRz/tmp)_EXE_ROOT_TMPDIRosgetuid_ROOT_TMPDIRenvironget)odirr   s   &&r   get_tmp_ancestorr      s?    	yy{a::>>(F++r   c                $    V ^8  d   QhR\         /# r   r   )r
   s   "r   r   r      s      D r   c                6   \        W4      p\        P                  P                  V4      '       g.   \        P                  ! V4       \        P
                  ! VR4       V'       d4   \        P                  ! VR4      '       d   \        P                  RV4       V# )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)
r   r   pathisdirmakedirschmodr   has_mount_optLOGwarning)r   r   tdirs   && r   _tempfile_dir_argr#      sl     D,D77==
D
vdH--KK%
 Kr   c                     a \        4       V R &   \        P                  ! R/ V B oR pVSn        V3R lp\	        SRV4       S# )dirc                      \         P                  ! V 4       R #   \         d-   pTP                  \        P                  8w  d   Th R p?R # R p?ii ; iN)r   unlinkOSErrorerrnoENOENT)r   es   & r   _unlink_if_exists0ExtendedTemporaryFile.<locals>._unlink_if_exists?   s<    	IIdO 	ww%,,& '	s    A!AAc                  >   < S P                  S P                  4       R # r'   )r(   name)fhs   r   
unlink_now)ExtendedTemporaryFile.<locals>.unlink_nowM   s    
		"''r   r2    )r#   tempfileNamedTemporaryFiler(   setattr)kwargsr-   r2   r1   s   ,  @r   ExtendedTemporaryFiler9   8   sH    %'F5M		$	$	.v	.B
 "BI Bj)Ir   c              +      "   \        R/ VB p Vx  \        P                  ! W R 7       R#   \        P                  ! Y R 7       i ; i5i))ignore_errorsNr4   )mkdtempshutilrmtree)rmtree_ignore_errorsr8   r"   s   &, r   tempdirr@   T   s7     
 VD@
d?d?s   A, AAAc                $    V ^8  d   QhR\         /# r   r   )r
   s   "r   r   r   `        / / /r   c                 H    \        W4      p \        P                  ! RR V /VB # r%   r4   )r#   r5   r<   r%   r   r8   s   &&,r   r<   r<   `   %    
C
+C..v..r   c                $    V ^8  d   QhR\         /# r   r   )r
   s   "r   r   r   e   rB   r   c                 H    \        W4      p \        P                  ! RR V /VB # rD   )r#   r5   mkstemprE   s   &&,r   rI   rI   e   rF   r   )NF)F)
contextlibr*   loggingr   r=   r5   	cloudinitr   	getLogger__name__r    r   r   r   r#   r9   contextmanagerr@   r<   rI   r4   r   r   <module>rP      sq       	   !$( ,:8 @ @/
/ /r   