git: 279f98470572 - stable/14 - nuageinit: pet luacheck

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 23 Jun 2025 07:44:15 UTC
The branch stable/14 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=279f98470572f39c6ead7ecce973c4eefbceeecf

commit 279f98470572f39c6ead7ecce973c4eefbceeecf
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2025-06-10 09:32:06 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2025-06-23 07:43:12 +0000

    nuageinit: pet luacheck
    
    Rename path into ni_path (ni stands for nuageinit) which is more
    understandable and avoid a shadowing warning because we also use a
    variable named path later.
    
    Add a missing local
    
    (cherry picked from commit f678c47590276aa8acdacdecfb78cc6c44bbf449)
---
 libexec/nuageinit/nuageinit | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit
index cd5912c54975..c874f40b38a8 100755
--- a/libexec/nuageinit/nuageinit
+++ b/libexec/nuageinit/nuageinit
@@ -12,7 +12,7 @@ local sys_stat = require("posix.sys.stat")
 if #arg ~= 2 then
 	nuage.err("Usage: " .. arg[0] .. " <cloud-init-directory> (<config-2> | <nocloud>)", false)
 end
-local path = arg[1]
+local ni_path = arg[1]
 local citype = arg[2]
 
 local default_user = {
@@ -189,7 +189,7 @@ end
 
 if citype == "config-2" then
 	local parser = ucl.parser()
-	local res, err = parser:parse_file(path .. "/meta_data.json")
+	local res, err = parser:parse_file(ni_path .. "/meta_data.json")
 
 	if not res then
 		nuage.err("error parsing config-2 meta_data.json: " .. err)
@@ -204,9 +204,9 @@ if citype == "config-2" then
 	nuage.sethostname(obj["hostname"])
 
 	-- network
-	config2_network(path)
+	config2_network(ni_path)
 elseif citype == "nocloud" then
-	local f, err = io.open(path .. "/meta-data")
+	local f, err = io.open(ni_path .. "/meta-data")
 	if err then
 		nuage.err("error parsing nocloud meta-data: " .. err)
 	end
@@ -229,9 +229,9 @@ end
 -- deal with user-data
 local ud = nil
 local f = nil
-userdatas = {"user-data", "user_data"}
+local userdatas = {"user-data", "user_data"}
 for _, v in pairs(userdatas) do
-	f = io.open(path .. "/" .. v, "r")
+	f = io.open(ni_path .. "/" .. v, "r")
 	if f then
 		ud = v
 		break
@@ -243,7 +243,7 @@ end
 local line = f:read("*l")
 f:close()
 if line == "#cloud-config" then
-	f = io.open(path .. "/" .. ud)
+	f = io.open(ni_path .. "/" .. ud)
 	local obj = yaml.eval(f:read("*a"))
 	f:close()
 	if not obj then
@@ -405,7 +405,7 @@ if line == "#cloud-config" then
 	end
 elseif line:sub(1, 2) == "#!" then
 	-- delay for execution at rc.local time --
-	f = io.open(path .. "/" .. ud)
+	f = io.open(ni_path .. "/" .. ud)
 	local content = f:read("*a")
 	f:close()
 	nuage.mkdir_p(root .. "/var/cache/nuageinit")