summaryrefslogtreecommitdiff
path: root/cloudinit/temp_utils.py
diff options
context:
space:
mode:
authorDouglas Jordan <dojordan@microsoft.com>2018-01-24 16:10:08 -0700
committerChad Smith <chad.smith@canonical.com>2018-01-24 16:10:08 -0700
commitc03bdd3d8ed762cada813c5e95a40b14d2047b57 (patch)
tree708422bb64a8804f649ad7558d5088f9e11011a4 /cloudinit/temp_utils.py
parent30597f28512fafbe25486df5865b628d859486c6 (diff)
downloadcloud-init-git-c03bdd3d8ed762cada813c5e95a40b14d2047b57.tar.gz
Azure VM Preprovisioning support.
This change will enable azure vms to report provisioning has completed twice, first to tell the fabric it has completed then a second time to enable customer settings. The datasource for the second provisioning is the Instance Metadata Service (IMDS),and the VM will poll indefinitely for the new ovf-env.xml from IMDS. This branch introduces EphemeralDHCPv4 which encapsulates common logic used by both DataSourceEc2 an DataSourceAzure for temporary DHCP interactions without side-effects. LP: #1734991
Diffstat (limited to 'cloudinit/temp_utils.py')
-rw-r--r--cloudinit/temp_utils.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/cloudinit/temp_utils.py b/cloudinit/temp_utils.py
index 5d7adf70..c98a1b53 100644
--- a/cloudinit/temp_utils.py
+++ b/cloudinit/temp_utils.py
@@ -28,13 +28,18 @@ def _tempfile_dir_arg(odir=None, needs_exe=False):
if odir is not None:
return odir
+ if needs_exe:
+ tdir = _EXE_ROOT_TMPDIR
+ if not os.path.isdir(tdir):
+ os.makedirs(tdir)
+ os.chmod(tdir, 0o1777)
+ return tdir
+
global _TMPDIR
if _TMPDIR:
return _TMPDIR
- if needs_exe:
- tdir = _EXE_ROOT_TMPDIR
- elif os.getuid() == 0:
+ if os.getuid() == 0:
tdir = _ROOT_TMPDIR
else:
tdir = os.environ.get('TMPDIR', '/tmp')