File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -568,8 +568,8 @@ func (v *Validator) CheckLinux() (errs error) {
568568
569569 for index := 0 ; index < len (v .spec .Linux .Namespaces ); index ++ {
570570 ns := v .spec .Linux .Namespaces [index ]
571- if ! namespaceValid (ns ) {
572- errs = multierror .Append (errs , fmt . Errorf ( "namespace %v is invalid" , ns ) )
571+ if err := namespaceValid (ns ); err != nil {
572+ errs = multierror .Append (errs , err )
573573 }
574574
575575 tmpItem := nsTypeList [ns .Type ]
@@ -893,7 +893,7 @@ func (v *Validator) rlimitValid(rlimit rspec.POSIXRlimit) (errs error) {
893893 return
894894}
895895
896- func namespaceValid (ns rspec.LinuxNamespace ) bool {
896+ func namespaceValid (ns rspec.LinuxNamespace ) error {
897897 switch ns .Type {
898898 case rspec .PIDNamespace :
899899 case rspec .NetworkNamespace :
@@ -903,14 +903,14 @@ func namespaceValid(ns rspec.LinuxNamespace) bool {
903903 case rspec .UserNamespace :
904904 case rspec .CgroupNamespace :
905905 default :
906- return false
906+ return fmt . Errorf ( "invalid namespace type %s" , ns . Type )
907907 }
908908
909909 if ns .Path != "" && ! filepath .IsAbs (ns .Path ) {
910- return false
910+ return fmt . Errorf ( "%v is not an absolute path" , ns . Path )
911911 }
912912
913- return true
913+ return nil
914914}
915915
916916func pathValid (os , path string ) error {
You can’t perform that action at this time.
0 commit comments