git: ea3426bc80aa - main - nuageinit: Create parent directories in write_files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 08 Jun 2026 21:10:06 UTC
The branch main has been updated by dtxdf:
URL: https://cgit.FreeBSD.org/src/commit/?id=ea3426bc80aad58e689c144ec6ddee0cda7861cb
commit ea3426bc80aad58e689c144ec6ddee0cda7861cb
Author: Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
AuthorDate: 2026-06-08 21:05:09 +0000
Commit: Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
CommitDate: 2026-06-08 21:05:09 +0000
nuageinit: Create parent directories in write_files
Currently, 'write_files' does not create parent directories, and
'runcmd' cannot be used here, since those scripts run after the files
have been written. The only workaround is to create the files in an
existing directory, such as '/root' or '/tmp', and then move those
files using 'runcmd', but this is cumbersome when there are many files,
even if they are small.
With this change, nuageinit now creates the parent directories for each
file using the path field, which mimics the same behavior as in
cloud-init.
Permissions and ownership can also be configured using 'runcmd'.
Reviewed by: bapt@
Approved by: bapt@
Differential Revision: https://reviews.freebsd.org/D57395
---
libexec/nuageinit/nuage.lua | 1 +
libexec/nuageinit/nuageinit.7 | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index a554553b3e61..cbf92627918c 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -832,6 +832,7 @@ local function addfile(file, defer)
root = ""
end
local filepath = root .. file.path
+ mkdir_p(dirname(filepath))
local f = assert(io.open(filepath, mode))
if content then
f:write(content)
diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7
index e1c4b9d61382..a3d9da2415d9 100644
--- a/libexec/nuageinit/nuageinit.7
+++ b/libexec/nuageinit/nuageinit.7
@@ -3,7 +3,7 @@
.\" Copyright (c) 2025 Baptiste Daroussin <bapt@FreeBSD.org>
.\" Copyright (c) 2025 Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
.\"
-.Dd June 6, 2026
+.Dd June 8, 2026
.Dt NUAGEINIT 7
.Os
.Sh NAME
@@ -615,7 +615,7 @@ and
are supported for now.
.It Ic path
The path of the file to be created.
-.Pq Note intermerdiary directories will not be created .
+.Pq Note intermerdiary directories will be created .
.It Ic permissions
A string representing the permission of the file in octal.
.It Ic owner