From nobody Tue Nov 25 00:43:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dFkSP5tCvz6H6j9 for ; Tue, 25 Nov 2025 00:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dFkSP59Qtz426b for ; Tue, 25 Nov 2025 00:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764031381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J4btw5fGfmmmqrGYSVoLqek44gv8IG6vcAhJdlmv0gs=; b=IAZfAN9Ginjijg2ZkD5QDk+dnSMzk7yux0LG1PCKkrIFav09H8zGRXXNyEGhOa0cg5euwV vtJhPPAwrLeLVyU7G1mmPisj1QGLpTYxZZ7R6SHhxWGEmycpGoJn5sJ6aZiGekRMl6kQPC JD9Mey9nBgOfDYM23OjnyvbEc1ctronUugd0+tNFOi5AuMYnQ/bWKZaBcjl85lqyzXBkDL 13yxhQ0l8An4X0ULMRo/4K0uWUKrUXUC3XIxpTZG0d5vKmF6pxC8rumvNbf0a8PpMNDlGg n3EclhkB7n6dCmUUBJ4Nbs68KZPUFZ0cfO+juaT/r7iWr3GIXHhMIQEyeUwnFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764031381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J4btw5fGfmmmqrGYSVoLqek44gv8IG6vcAhJdlmv0gs=; b=cUY68rr5KDqNguyJkGo9suBZmWXzyojnoPZo3AME4DJIdb5Jpeoe+aXG5ADRqNwqe8QjQn 52aKjttVMn/cPlxHcJeDX758ptnioiKm4hSmGO1D0qEpwn32lxjNxaku+eADvVTqSfTian I7uxutXB2qQzDJbP0kY2IS/mSy9K2cH+wKdB9Hxmh/tSOEttco3L2HMr+SF8IfDg1K+6ET dA4EVCgT+VMUVWTRXwBVY/niz5Kd/p2UJUHNKGWJPXk3Pb/LS3lYofX42zKtaIHeUApiVY I2mDPktH6d0v3IHwX9WjOA+sbrLd+KqE7v2oDnAedZxy7zxOtWVs7QKyXojXIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764031381; a=rsa-sha256; cv=none; b=gX545dOSGFUibznyIPxUL7Brwlf1/kQBPzfmBnllbt529p99n0cHiq/O7jDsrfXo6cy8OE bqPOI9xb21T6R3Z7HB20DDHJ/P1D8Gi+AAdUZPo7UTHrmz6jsy7hf0XJN6H6bsFRpnDTB6 5MidihiJ+dwKDxvqfZ4iCiO6KAgsyINOwbK27xqeqzLrR1KaDQlfLRFqlIED4pYdOxn0nG 5SIkitpvgL1t2dYsU5sIxCJP8qrvsL7qbitYaf5E9PywaL112RidQV9tzFm0q4ZyT5ZtRl 4KFd1bTe0MER0R/dx2ZdSvGcUg1UyIKaNaveN5upqB/PFQ04kFB1wIQGq781iQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dFkSP4mm8zdP6 for ; Tue, 25 Nov 2025 00:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24f53 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 25 Nov 2025 00:43:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jose Luis Duran Subject: git: a5adb1ca3526 - stable/15 - nuageinit: Silence luacheck warnings and fix typos List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: a5adb1ca3526e3a0139cf4305effa8ec527580f3 Auto-Submitted: auto-generated Date: Tue, 25 Nov 2025 00:43:01 +0000 Message-Id: <6924fb95.24f53.4220a51b@gitrepo.freebsd.org> The branch stable/15 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=a5adb1ca3526e3a0139cf4305effa8ec527580f3 commit a5adb1ca3526e3a0139cf4305effa8ec527580f3 Author: Jose Luis Duran AuthorDate: 2025-10-21 13:28:45 +0000 Commit: Jose Luis Duran CommitDate: 2025-11-25 00:39:15 +0000 nuageinit: Silence luacheck warnings and fix typos No functional change intended. Reviewed by: bapt, dtxdf, kevans MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53238 (cherry picked from commit 81af04b081402d131c7e34b30c88b7c337271fad) --- libexec/nuageinit/nuage.lua | 6 ++---- libexec/nuageinit/nuageinit | 24 +++++++++++------------- libexec/nuageinit/tests/addfile.lua | 2 +- libexec/nuageinit/tests/nuageinit.sh | 2 +- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index 3eeb2ea0b44c..2d962b540b23 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -69,7 +69,7 @@ local function errmsg(str, prepend) end local function chmod(path, mode) - local mode = tonumber(mode, 8) + mode = tonumber(mode, 8) local _, err, msg = sys_stat.chmod(path, mode) if err then errmsg("chmod(" .. path .. ", " .. mode .. ") failed: " .. msg) @@ -150,8 +150,6 @@ local function splitlines(s) end local function getgroups() - local ret = {} - local root = os.getenv("NUAGE_FAKE_ROOTDIR") local cmd = "pw " if root then @@ -579,7 +577,7 @@ local function settimezone(timezone) root = "/" end - f, _, rc = os.execute("tzsetup -s -C " .. root .. " " .. timezone) + local f, _, rc = os.execute("tzsetup -s -C " .. root .. " " .. timezone) if not f then warnmsg("Impossible to configure time zone ( rc = " .. rc .. " )") diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index f68e45701b6c..148f5b3b30cd 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -228,10 +228,10 @@ local function nameservers(interface, obj) local resolv_conf = root .. "/etc/resolv.conf" - resolv_conf_attr = lfs.attributes(resolv_conf) + local resolv_conf_attr = lfs.attributes(resolv_conf) if resolv_conf_attr == nil then - resolv_conf_handler = open_resolv_conf() + local resolv_conf_handler = open_resolv_conf() resolv_conf_handler:close() end @@ -294,10 +294,11 @@ local function match_rules(rules) -- with the matching interfaces must be returned. This changes the way we initially -- thought about our implementation, since at first we only needed one interface, -- but cloud-init performs actions on a group of matching interfaces. + local interface local interfaces = {} if rules.macaddress then local ifaces = get_ifaces_by_mac() - local interface = ifaces[rules.macaddress] + interface = ifaces[rules.macaddress] if not interface then nuage.warn("not interface matching by MAC address: " .. rules.macaddress) return @@ -347,11 +348,11 @@ local function write_files(files, defer) end end -local function write_files_not_defered(obj) +local function write_files_not_deferred(obj) write_files(obj.write_files, false) end -local function write_files_defered(obj) +local function write_files_deferred(obj) write_files(obj.write_files, true) end -- Set network configuration from user_data @@ -380,6 +381,7 @@ local function network_config(obj) extra_opts = extra_opts .. " wol" end if v.mtu then + local mtu if type(v.mtu) == "number" then mtu = tostring(v.mtu) else @@ -679,14 +681,14 @@ if line == "#cloud-config" then network_config, ssh_pwauth, runcmd, - write_files_not_defered, + write_files_not_deferred, } local post_network_calls = { packages, users, chpasswd, - write_files_defered, + write_files_deferred, } f = io.open(ni_path .. "/" .. ud) @@ -703,12 +705,8 @@ if line == "#cloud-config" then for i = 1, #calls_table do if citype == "nocloud" and calls_table[i] == network_config then - netobj = parse_network_config() - if netobj == nil then - network_config(obj) - else - network_config(netobj) - end + local netobj = parse_network_config() or obj + network_config(netobj) else calls_table[i](obj) end diff --git a/libexec/nuageinit/tests/addfile.lua b/libexec/nuageinit/tests/addfile.lua index 98d020e557c0..ea98369f1909 100644 --- a/libexec/nuageinit/tests/addfile.lua +++ b/libexec/nuageinit/tests/addfile.lua @@ -35,7 +35,7 @@ if str ~= f.content then n.err("Invalid file content") end --- the file is overwriten +-- the file is overwritten f.content = "test" str = addfile_and_getres(f) diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh index 2b7c5226c97a..851f7110378a 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -890,7 +890,7 @@ EOF atf_check -o inline:"plop" cat file1 atf_check -o inline:"" cat emptyfile atf_check -o inline:"bla\n" cat file_base64 - test -f foo && atf_fail "foo creation should have been defered" + test -f foo && atf_fail "foo creation should have been deferred" atf_check -o match:"^-rwxr-xr-x.*nobody" ls -l file_base64 rm file1 emptyfile file_base64 atf_check -o empty /usr/libexec/nuageinit "${PWD}"/media/nuageinit postnet