From df956b9188eca8804e7ac15a476e0fa02f09811e Mon Sep 17 00:00:00 2001 From: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:58:25 +0000 Subject: [PATCH] backport of commit 5dfb38d80667e3ae3985a369fa86c9fcc6697e23 --- drivers/shared/capabilities/defaults.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/shared/capabilities/defaults.go b/drivers/shared/capabilities/defaults.go index 6323590a7a8..b86d7aacf98 100644 --- a/drivers/shared/capabilities/defaults.go +++ b/drivers/shared/capabilities/defaults.go @@ -6,6 +6,7 @@ package capabilities import ( "fmt" "regexp" + "runtime" "github.com/moby/sys/capability" ) @@ -40,7 +41,17 @@ func NomadDefaults() *Set { func Supported() *Set { s := New(nil) - list, _ := capability.ListSupported() + var list []capability.Cap + + switch runtime.GOOS { + case "linux": + list, _ = capability.ListSupported() + default: + // capability.ListSupported() will always return an empty list on + // non-linux systems + list = capability.ListKnown() + } + // accumulate every capability supported by this system for _, c := range list { s.Add(c.String())