summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_write_files.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config/cc_write_files.py')
-rw-r--r--cloudinit/config/cc_write_files.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/cloudinit/config/cc_write_files.py b/cloudinit/config/cc_write_files.py
index f7d89935..a517d044 100644
--- a/cloudinit/config/cc_write_files.py
+++ b/cloudinit/config/cc_write_files.py
@@ -37,15 +37,18 @@ meta: MetaSchema = {
before being written. For empty file creation, content can be omitted.
.. note::
- if multiline data is provided, care should be taken to ensure that it
- follows yaml formatting standards. to specify binary data, use the yaml
+ If multiline data is provided, care should be taken to ensure that it
+ follows yaml formatting standards. To specify binary data, use the yaml
option ``!!binary``
.. note::
Do not write files under /tmp during boot because of a race with
systemd-tmpfiles-clean that can cause temp files to get cleaned during
the early boot process. Use /run/somedir instead to avoid race
- LP:1707222."""
+ LP:1707222.
+
+ .. warning::
+ Existing files will be overridden."""
),
"distros": ["all"],
"examples": [
@@ -179,7 +182,9 @@ def write_files(name, files, owner: str):
(u, g) = util.extract_usergroup(f_info.get("owner", owner))
perms = decode_perms(f_info.get("permissions"), DEFAULT_PERMS)
omode = "ab" if util.get_cfg_option_bool(f_info, "append") else "wb"
- util.write_file(path, contents, omode=omode, mode=perms)
+ util.write_file(
+ path, contents, omode=omode, mode=perms, user=u, group=g
+ )
util.chownbyname(path, u, g)