nuageinit: enhance sudo support

from the cloudinit specification sudo rules can be a string or an
array of string
This commit is contained in:
Baptiste Daroussin
2025-06-26 14:32:27 +02:00
parent 3969965c7f
commit b56d2195f1
3 changed files with 15 additions and 3 deletions
+7 -1
View File
@@ -287,7 +287,13 @@ local function addsudo(pwd)
warnmsg("impossible to open " .. sudoers)
return
end
f:write(pwd.name .. " " .. pwd.sudo .. "\n")
if type(pwd.sudo) == "string" then
f:write(pwd.name .. " " .. pwd.sudo .. "\n")
elseif type(pwd.sudo) == "table" then
for _, str in ipairs(pwd.sudo) do
f:write(pwd.name .. " " .. str .. "\n")
end
end
f:close()
if chmodsudoers then
sys_stat.chmod(sudoers, 416)