diff options
author | Scott Moser <smoser@brickies.net> | 2017-08-29 09:59:20 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-09-07 15:22:54 -0400 |
commit | 409918f9ba83e45e9bc5cc0b6c589e2fc8ae9b60 (patch) | |
tree | 9ed541b0118d6cb5a2b276e9a0473d8cd9ad2c18 /cloudinit/config/cc_bootcmd.py | |
parent | dcbb901cc3e9e888bc8f87e87bdc0ca8436a2baa (diff) | |
download | vyos-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_bootcmd.py')
-rw-r--r-- | cloudinit/config/cc_bootcmd.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/config/cc_bootcmd.py b/cloudinit/config/cc_bootcmd.py index 604f93b0..9c0476af 100644 --- a/cloudinit/config/cc_bootcmd.py +++ b/cloudinit/config/cc_bootcmd.py @@ -37,6 +37,7 @@ specified either as lists or strings. For invocation details, see ``runcmd``. import os from cloudinit.settings import PER_ALWAYS +from cloudinit import temp_utils from cloudinit import util frequency = PER_ALWAYS @@ -49,7 +50,7 @@ def handle(name, cfg, cloud, log, _args): " no 'bootcmd' key in configuration"), name) return - with util.ExtendedTemporaryFile(suffix=".sh") as tmpf: + with temp_utils.ExtendedTemporaryFile(suffix=".sh") as tmpf: try: content = util.shellify(cfg["bootcmd"]) tmpf.write(util.encode_text(content)) |