Skip to content

Commit

Permalink
chore: remove redundant caps checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpig committed Dec 11, 2024
1 parent e623ca2 commit d5bdd40
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strings"
"syscall"

"github.com/nixpig/brownie/capabilities"
"github.com/nixpig/brownie/lifecycle"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -78,48 +77,6 @@ func New(
return nil, errors.New("root is required")
}

if spec.Process != nil && spec.Process.Capabilities != nil {
if spec.Process.Capabilities.Ambient != nil {
for _, e := range spec.Process.Capabilities.Ambient {
if _, ok := capabilities.Capabilities[e]; !ok {
return nil, fmt.Errorf("capabilitity '%s' cannot be mapped", e)
}
}
}

if spec.Process.Capabilities.Bounding != nil {
for _, e := range spec.Process.Capabilities.Bounding {
if _, ok := capabilities.Capabilities[e]; !ok {
return nil, fmt.Errorf("capabilitity '%s' cannot be mapped", e)
}
}
}

if spec.Process.Capabilities.Effective != nil {
for _, e := range spec.Process.Capabilities.Effective {
if _, ok := capabilities.Capabilities[e]; !ok {
return nil, fmt.Errorf("capabilitity '%s' cannot be mapped", e)
}
}
}

if spec.Process.Capabilities.Permitted != nil {
for _, e := range spec.Process.Capabilities.Permitted {
if _, ok := capabilities.Capabilities[e]; !ok {
return nil, fmt.Errorf("capabilitity '%s' cannot be mapped", e)
}
}
}

if spec.Process.Capabilities.Inheritable != nil {
for _, e := range spec.Process.Capabilities.Inheritable {
if _, ok := capabilities.Capabilities[e]; !ok {
return nil, fmt.Errorf("capabilitity '%s' cannot be mapped", e)
}
}
}
}

absBundlePath, err := filepath.Abs(bundle)
if err != nil {
return nil, fmt.Errorf("construct absolute bundle path: %w", err)
Expand Down

0 comments on commit d5bdd40

Please sign in to comment.