summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_chef.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-08-29 09:59:20 -0400
committerScott Moser <smoser@brickies.net>2017-09-07 15:22:54 -0400
commit409918f9ba83e45e9bc5cc0b6c589e2fc8ae9b60 (patch)
tree9ed541b0118d6cb5a2b276e9a0473d8cd9ad2c18 /cloudinit/config/cc_chef.py
parentdcbb901cc3e9e888bc8f87e87bdc0ca8436a2baa (diff)
downloadvyos-cloud-init-409918f9ba83e45e9bc5cc0b6c589e2fc8ae9b60.tar.gz
vyos-cloud-init-409918f9ba83e45e9bc5cc0b6c589e2fc8ae9b60.zip
Use /run/cloud-init for tempfile operations.
During boot, the usage of /tmp is not safe. In systemd systems, systemd-tmpfiles-clean may run at any point and clear out a temp file while cloud-init is using it. The solution here is to use /run/cloud-init/tmp. LP: #1707222
Diffstat (limited to 'cloudinit/config/cc_chef.py')
-rw-r--r--cloudinit/config/cc_chef.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
index 02c70b10..c192dd32 100644
--- a/cloudinit/config/cc_chef.py
+++ b/cloudinit/config/cc_chef.py
@@ -71,6 +71,7 @@ import itertools
import json
import os
+from cloudinit import temp_utils
from cloudinit import templater
from cloudinit import url_helper
from cloudinit import util
@@ -303,7 +304,7 @@ def install_chef(cloud, chef_cfg, log):
"omnibus_url_retries",
default=OMNIBUS_URL_RETRIES))
content = url_helper.readurl(url=url, retries=retries).contents
- with util.tempdir() as tmpd:
+ with temp_utils.tempdir() as tmpd:
# Use tmpdir over tmpfile to avoid 'text file busy' on execute
tmpf = "%s/chef-omnibus-install" % tmpd
util.write_file(tmpf, content, mode=0o700)