Viewing File: /usr/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>