@@ -89,7 +89,7 @@ func bundleValidate(spec rspec.Spec, rootfs string, hooksCheck bool) {
8989 checkSemVer (spec .Version )
9090 checkPlatform (spec .Platform )
9191 checkProcess (spec .Process , rootfs )
92- checkLinux (spec . Linux , spec . Hostname , rootfs )
92+ checkLinux (spec )
9393 checkHooks (spec .Hooks , hooksCheck )
9494}
9595
@@ -182,39 +182,39 @@ func checkProcess(process rspec.Process, rootfs string) {
182182}
183183
184184//Linux only
185- func checkLinux (spec rspec.Linux , hostname string , rootfs string ) {
185+ func checkLinux (spec rspec.Spec ) {
186186 utsExists := false
187187
188- if len (spec .UIDMappings ) > 5 {
188+ if len (spec .Linux . UIDMappings ) > 5 {
189189 logrus .Fatalf ("Only 5 UID mappings are allowed (linux kernel restriction)." )
190190 }
191- if len (spec .GIDMappings ) > 5 {
191+ if len (spec .Linux . GIDMappings ) > 5 {
192192 logrus .Fatalf ("Only 5 GID mappings are allowed (linux kernel restriction)." )
193193 }
194194
195- for index := 0 ; index < len (spec .Namespaces ); index ++ {
196- if ! namespaceValid (spec .Namespaces [index ]) {
197- logrus .Fatalf ("namespace %v is invalid." , spec .Namespaces [index ])
198- } else if spec .Namespaces [index ].Type == rspec .UTSNamespace {
195+ for index := 0 ; index < len (spec .Linux . Namespaces ); index ++ {
196+ if ! namespaceValid (spec .Linux . Namespaces [index ]) {
197+ logrus .Fatalf ("namespace %v is invalid." , spec .Linux . Namespaces [index ])
198+ } else if spec .Linux . Namespaces [index ].Type == rspec .UTSNamespace {
199199 utsExists = true
200200 }
201201 }
202202
203- if ! utsExists && hostname != "" {
203+ if spec . Platform . OS == "linux" && ! utsExists && spec . Hostname != "" {
204204 logrus .Fatalf ("Hostname requires a new UTS namespace to be specified as well" )
205205 }
206206
207- for index := 0 ; index < len (spec .Devices ); index ++ {
208- if ! deviceValid (spec .Devices [index ]) {
209- logrus .Fatalf ("device %v is invalid." , spec .Devices [index ])
207+ for index := 0 ; index < len (spec .Linux . Devices ); index ++ {
208+ if ! deviceValid (spec .Linux . Devices [index ]) {
209+ logrus .Fatalf ("device %v is invalid." , spec .Linux . Devices [index ])
210210 }
211211 }
212212
213- if spec .Seccomp != nil {
214- checkSeccomp (* spec .Seccomp )
213+ if spec .Linux . Seccomp != nil {
214+ checkSeccomp (* spec .Linux . Seccomp )
215215 }
216216
217- switch spec .RootfsPropagation {
217+ switch spec .Linux . RootfsPropagation {
218218 case "" :
219219 case "private" :
220220 case "rprivate" :
0 commit comments