@@ -256,28 +256,30 @@ func (v *Validator) CheckProcess() (msgs []string) {
256256 }
257257 }
258258
259- for _ , capability := range process .Capabilities {
260- if err := CapValid (capability , v .HostSpecific ); err != nil {
261- msgs = append (msgs , fmt .Sprintf ("capability %q is not valid, man capabilities(7)" , capability ))
259+ if v .spec .Platform .OS == "linux" {
260+ for _ , capability := range process .Capabilities {
261+ if err := CapValid (capability , v .HostSpecific ); err != nil {
262+ msgs = append (msgs , fmt .Sprintf ("capability %q is not valid, man capabilities(7)" , capability ))
263+ }
262264 }
263- }
264265
265- for index , rlimit := range process .Rlimits {
266- if err := rlimitValid (rlimit ); err != nil {
267- msgs = append (msgs , err .Error ())
268- }
269- for i := index + 1 ; i < len (process .Rlimits ); i ++ {
270- if process .Rlimits [index ].Type == process .Rlimits [i ].Type {
271- msgs = append (msgs , fmt .Sprintf ("rlimit can not contain the same type %q." , process .Rlimits [index ].Type ))
266+ for index , rlimit := range process .Rlimits {
267+ if err := rlimitValid (rlimit ); err != nil {
268+ msgs = append (msgs , err .Error ())
269+ }
270+ for i := index + 1 ; i < len (process .Rlimits ); i ++ {
271+ if process .Rlimits [index ].Type == process .Rlimits [i ].Type {
272+ msgs = append (msgs , fmt .Sprintf ("rlimit can not contain the same type %q." , process .Rlimits [index ].Type ))
273+ }
272274 }
273275 }
274- }
275276
276- if len (process .ApparmorProfile ) > 0 {
277- profilePath := filepath .Join (v .bundlePath , v .spec .Root .Path , "/etc/apparmor.d" , process .ApparmorProfile )
278- _ , err := os .Stat (profilePath )
279- if err != nil {
280- msgs = append (msgs , err .Error ())
277+ if len (process .ApparmorProfile ) > 0 {
278+ profilePath := filepath .Join (v .bundlePath , v .spec .Root .Path , "/etc/apparmor.d" , process .ApparmorProfile )
279+ _ , err := os .Stat (profilePath )
280+ if err != nil {
281+ msgs = append (msgs , err .Error ())
282+ }
281283 }
282284 }
283285
0 commit comments