diff options
| author | Chad Smith <chad.smith@canonical.com> | 2018-02-02 11:11:36 -0700 |
|---|---|---|
| committer | Chad Smith <chad.smith@canonical.com> | 2018-02-02 11:11:36 -0700 |
| commit | 78013bc65030421699b5feb66bc8b7a205abfbc0 (patch) | |
| tree | 2ebf7111129f4aaf8a833ba6d226d4513ed59388 /cloudinit/temp_utils.py | |
| parent | 192261fe38a32edbd1f605ba25bbb6f4822a0720 (diff) | |
| parent | f7deaf15acf382d62554e2b1d70daa9a9109d542 (diff) | |
| download | vyos-cloud-init-78013bc65030421699b5feb66bc8b7a205abfbc0.tar.gz vyos-cloud-init-78013bc65030421699b5feb66bc8b7a205abfbc0.zip | |
merge from master at 17.2-30-gf7deaf15
Diffstat (limited to 'cloudinit/temp_utils.py')
| -rw-r--r-- | cloudinit/temp_utils.py | 11 |
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') |
