Current File : //lib/python2.7/site-packages/cloudinit/temp_utils.pyo |
�
oB�]c @ s� d d l Z d d l Z d d l Z d d l Z d d l Z d a d Z d Z d e d � Z
d � Z e j e d � � Z
d � Z d � Z d S( i����Ns /run/cloud-init/tmps /var/tmp/cloud-initc C s� | d k r | S| rR t } t j j | � sN t j | � t j | d � n | St r\ t St j � d k rw t } n t j
j d d � } t j j | � s� t j | � t j | d � n | a | S( s% 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� i t TMPDIRs /tmpN( t Nonet _EXE_ROOT_TMPDIRt ost patht isdirt makedirst chmodt _TMPDIRt getuidt _ROOT_TMPDIRt environt get( t odirt needs_exet tdir( ( s8 /usr/lib/python2.7/site-packages/cloudinit/temp_utils.pyt _tempfile_dir_arg s$
c so t | j d d � | j d t � � | d <t j | � � d � } | � _ � f d � } t � d | � � S( Nt dirR c S sF y t j | � Wn. t k
rA } | j t j k rB | � qB n Xd S( N( R t unlinkt OSErrort errnot ENOENT( R t e( ( s8 /usr/lib/python2.7/site-packages/cloudinit/temp_utils.pyt _unlink_if_exists>