ó oBú]c@s‘ddlZddlZddlZddlZddlZdadZdZde d„Z d„Z ej e d„ƒZ d„Zd„ZdS( iÿÿÿÿNs/run/cloud-init/tmps/var/tmp/cloud-initcCsÈ|dk r|S|rRt}tjj|ƒsNtj|ƒtj|dƒn|Str\tStjƒdkrwt }ntj j ddƒ}tjj|ƒs¾tj|ƒtj|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ÿitTMPDIRs/tmpN( tNonet_EXE_ROOT_TMPDIRtostpathtisdirtmakedirstchmodt_TMPDIRtgetuidt _ROOT_TMPDIRtenvirontget(todirt needs_exettdir((s8/usr/lib/python2.7/site-packages/cloudinit/temp_utils.pyt_tempfile_dir_args$    c sot|jddƒ|jdtƒƒ|ds csˆjˆjƒdS(N(Rtname((tfh(s8/usr/lib/python2.7/site-packages/cloudinit/temp_utils.pyt unlink_nowLsR(RtpopRtFalsettempfiletNamedTemporaryFileRtsetattr(tkwargsRR((Rs8/usr/lib/python2.7/site-packages/cloudinit/temp_utils.pytExtendedTemporaryFile6s(  cks0t|}z |VWdtj|d|ƒXdS(Nt ignore_errors(tmkdtemptshutiltrmtree(trmtree_ignore_errorsR R((s8/usr/lib/python2.7/site-packages/cloudinit/temp_utils.pyttempdirSs  cKs8t|jddƒ|jdtƒƒ|ds     (