Skip to content

Commit

Permalink
backport of commit 5dfb38d (#24453)
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>
  • Loading branch information
hc-github-team-nomad-core and pkazmierczak authored Nov 13, 2024
1 parent 019648f commit 718642f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/shared/capabilities/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package capabilities
import (
"fmt"
"regexp"
"runtime"

"github.com/moby/sys/capability"
)
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 718642f

Please sign in to comment.