Skip to content

Commit f6e16e8

Browse files
author
zhouhao
committed
validate: add the validation of devices.access
Signed-off-by: zhouhao <[email protected]>
1 parent 02e86dd commit f6e16e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

validate/validate.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,15 @@ func (v *Validator) CheckLinuxResources() (msgs []string) {
562562
msgs = append(msgs, fmt.Sprintf("type of devices %s is invalid", r.Devices[index].Type))
563563
}
564564

565+
access := []byte(r.Devices[index].Access)
566+
for i := 0; i < len(access); i++ {
567+
switch access[i] {
568+
case 'r', 'w', 'm':
569+
default:
570+
msgs = append(msgs, fmt.Sprintf("access %s is invalid", r.Devices[index].Access))
571+
return
572+
}
573+
}
565574
}
566575

567576
return

0 commit comments

Comments
 (0)