From 46aca458fbc42f1cafab29bc2307422e67ca197a Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 26 Feb 2026 19:03:57 +0100 Subject: [PATCH 1/2] salt.grain.core: do not crash at start on NetBSD and OpenBSD This avoids accessing an undefined element of the grains dictionary, on both NetBSD and OpenBSD. This matches the corresponding code for FreeBSD. Tested on NetBSD/amd64. --- salt/grains/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/grains/core.py b/salt/grains/core.py index 992532689a35..020ec1fd2a20 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -2823,7 +2823,7 @@ def os_data(): grains["osfullname"] = "{} {}".format(grains["kernel"], grains["osrelease"]) grains.update(_bsd_cpudata(grains)) elif grains["kernel"] in ("OpenBSD", "NetBSD"): - grains["os_family"] = grains["os"] = grains["kernel"] + grains["os_family"] = grains["osfullname"] = grains["os"] = grains["kernel"] grains.update(_bsd_cpudata(grains)) grains["osrelease"] = grains["kernelrelease"].split("-")[0] grains["osfullname"] = "{} {}".format(grains["kernel"], grains["osrelease"]) From 00a2a1dc448e294395c629091c3069fbe27624d6 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 26 Feb 2026 19:07:11 +0100 Subject: [PATCH 2/2] salt.utils.network: do not crash at start on NetBSD This patch restricts the OS version test to the part before "_" on NetBSD; this could raise an exception if py-packaging wasn't aware of the suffix (e.g., "BETA" would work but "STABLE" not). Tested on NetBSD/amd64. --- salt/utils/network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/utils/network.py b/salt/utils/network.py index 69384819d3bf..e05255869eda 100644 --- a/salt/utils/network.py +++ b/salt/utils/network.py @@ -1099,7 +1099,7 @@ def netbsd_interfaces(): address) """ # NetBSD versions prior to 8.0 can still use linux_interfaces() - if Version(os.uname()[2]) < Version("8.0"): + if Version(os.uname()[2].split("_")[0]) < Version("8.0"): return linux_interfaces() ifconfig_path = salt.utils.path.which("ifconfig")