From nobody Wed Sep 17 19:34:20 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 4cRpqd3lj1z67wk1; Wed, 17 Sep 2025 19:34:21 +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 4cRpqd22N2z4Bdh; Wed, 17 Sep 2025 19:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758137661; 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=4/b6bLE/y3QPGegxu77yxJlwY3R1Feh3WKkFxoldIUs=; b=YWSFRcEaknHsimUUymosyvzOPZtBLDAk1qefyWL3Gsjbqcum9fTFgMm7HQ/7QTHreWrYIt U5hF8rs0ooMZzDqlhWDKbgA/4ltDvAeDJeWFcKxzJE+tBpyQ3kRPO5s2XLRz2AAIPvkHEE jt3PknDccOc2UbgjaApMDuSl+T83Zt/BSsmauzl3PuQaz2W4HRLSjep5vU5HOpWJYJYaTf UZv1NpE7HvdZekMcHTaRRmHQBU030IALc3zKSr0GXlhmrxfcG8CUWPfaaulhFmOgNGu5LG j7f/W1p/+yESua9JJxWhgHsCHzhalv5wBBOs1fU0Z4wtECpRR6/2EWG6Ph0Bng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758137661; 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=4/b6bLE/y3QPGegxu77yxJlwY3R1Feh3WKkFxoldIUs=; b=wJa0ZfBnsMVUO31nClKKAvl34LdS9yDU7kZZ8JCWRcYBCTX6xSNi+u7T1PjXviO59eEJS2 OYtZyN4UAwgjTTbV32FZ05mKOod92n/6t0T9ExAtIun4g5s/kzuWdDmnQwtzWx2bUCFRzg luvcLyOs4GgW3y2KQfh/kx5hoziyESUzH2Os/AnFJNXU9kRTlSw++728TMqQ7x39MVSZCn 9H4GfMiy57guX0GlQ/Voiq2c2GrTxi2uyMafesQMsruABf0k8yUrFbjfnETt1FECyOqftI nlfUDcqi7Smq761CmCZm7KxyPZHG2JNiD02KGQEgxfM5ue9bZLC3HXy6SIiPGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758137661; a=rsa-sha256; cv=none; b=dLOsRP8IZoEEfnuXo1Uabh3rTh75RdKLqH1M9hVn+Edc4gLiPbedT7hcifJX1gPZftUxz6 eKVzS7kBGzEeBeSpTcZrvyzwCIe+Pcumhw5AwxX+hlfGLSUu33nO0E0LWyX4mk0iyKZ40a VM77XGjRQo4+kIWry+luMybe5vTrOKU2RMTNUcojPH+HpWzsO2vevWHSngoCDOE6rwsxmo SeN8x5e0GPPbJ0s6IPxChKI+qVlKvvGmPbIEfkews2R3jKZKOEDR9IjDN+5xEWLMyf05/s o7oSQwL9iL0X/1LmDGIGy3CY1qF6DvUYES3Cg3uMX8usE4+uwr7Ic6JaJO0T8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cRpqd00tVzg3v; Wed, 17 Sep 2025 19:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58HJYKE9014168; Wed, 17 Sep 2025 19:34:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58HJYKqw014165; Wed, 17 Sep 2025 19:34:20 GMT (envelope-from git) Date: Wed, 17 Sep 2025 19:34:20 GMT Message-Id: <202509171934.58HJYKqw014165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 4a01ddbcd66e - stable/15 - nuageinit: Allow the use of network parameters from network-config 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: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 4a01ddbcd66eeabd821e6cfba45f9f2825450ef2 Auto-Submitted: auto-generated The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4a01ddbcd66eeabd821e6cfba45f9f2825450ef2 commit 4a01ddbcd66eeabd821e6cfba45f9f2825450ef2 Author: Jesús Daniel Colmenares Oviedo AuthorDate: 2025-09-11 16:52:30 +0000 Commit: Baptiste Daroussin CommitDate: 2025-09-17 19:33:57 +0000 nuageinit: Allow the use of network parameters from network-config To better comply with the cloud-init specification, we need to support the configuration of network-related parameters from the network-config file, which is common in most deployments. Reviewed by: bapt@ Approved by: bapt@ Differential Revision: https://reviews.freebsd.org/D52419 (cherry picked from commit 95230b248f6412c2d1c416c1e9795c3192cdf750) --- libexec/nuageinit/nuageinit | 31 ++++++++++++++++++++++++++++++- libexec/nuageinit/nuageinit.7 | 7 +++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index c94eb822ba0f..5541f6d0f164 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -583,6 +583,26 @@ local function config2_network(p) routing:close() end +local function parse_network_config() + local nc_file = ni_path .. "/network-config" + local nc_file_attr = lfs.attributes(nc_file) + if nc_file_attr == nil then + return + end + local f, err = io.open(nc_file) + if err then + nuage.err("error parsing nocloud network-config: " .. err) + end + local obj = yaml.load(f:read("*a")) + f:close() + if not obj then + nuage.err("error parsing nocloud network-config") + end + local netobj = {} + netobj["network"] = obj + return netobj +end + if citype == "config-2" then local parser = ucl.parser() local res, err = parser:parse_file(ni_path .. "/meta_data.json") @@ -679,7 +699,16 @@ if line == "#cloud-config" then end for i = 1, #calls_table do - calls_table[i](obj) + 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 + else + calls_table[i](obj) + end end elseif line:sub(1, 2) == "#!" then -- delay for execution at rc.local time -- diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index fd82eb84574d..e5da5cf342e1 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -183,6 +183,13 @@ configuration in .Pa /etc/ssh/sshd_config .It Ic network Network configuration parameters. +.Pp +Specifying the following parameters from a file named +.Pa network-config +takes precedence over their specification from the +.Ic network +parameter of +.Pa user-data Ns . .Bl -tag -width "ethernets" .It Ic ethernets Mapping representing a generic configuration for existing network interfaces.