diff options
| author | Gonéri Le Bouder <goneri@lebouder.net> | 2026-01-03 02:11:55 +0000 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-06 08:25:14 +0000 |
| commit | 7af8b75201b7af353fa74c8feb937b52f5ccf9bb (patch) | |
| tree | 7f97f93559f0f8864f0ef8b39a1706f4eb5503a9 | |
| parent | e018fedef0a6389240322da9fa4b9fa9971f6e59 (diff) | |
| -rwxr-xr-x | libexec/nuageinit/nuageinit | 25 | ||||
| -rw-r--r-- | libexec/nuageinit/nuageinit.7 | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index a5411c60b410..9aaec1b87a6a 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -236,9 +236,16 @@ local function nameservers(interface, obj) resolv_conf_handler:close() end - if not os.execute("resolvconf -a " .. interface .. " < " .. resolv_conf) then + -- Only call resolvconf with interface if interface is provided + if interface then + resolvconf_command = "resolvconf -a " .. interface .. " < " .. resolv_conf + else + resolvconf_command = "resolvconf -u" + end + if not os.execute(resolvconf_command) then nuage.warn("Failed to execute resolvconf(8)") end + end local function install_packages(packages) @@ -572,6 +579,22 @@ local function config2_network(p) --end end end + + -- Handle global nameservers from services section + if obj["services"] then + local dns_servers = {} + for _, service in pairs(obj["services"]) do + if service["type"] == "dns" then + table.insert(dns_servers, service["address"]) + end + end + if #dns_servers > 0 then + -- Use nameservers() function for global services + local nameserver_config = {addresses = dns_servers} + nameservers(nil, nameserver_config) + end + end + if #ipv4 > 0 then routing:write('static_routes="') routing:write(table.concat(ipv4, " ") .. '"\n') diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index 445902ccf2c0..4f6b6e269867 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -117,6 +117,8 @@ file supports the following keys: Array of network interfaces to be configured. .It Ic networks Array of network configurations to be set. +.It Ic services +Array of service configurations to be set (e.g: DNS). .El .El .Pp |
