Skip to content

Commit

Permalink
validate: modify the validation of mounts.type
Browse files Browse the repository at this point in the history
Signed-off-by: zhouhao <[email protected]>
  • Loading branch information
zhouhao committed Sep 18, 2017
1 parent 6bcd3b4 commit 9e97695
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,28 @@ func (v *Validator) CheckRlimits() (msgs []string) {
func supportedMountTypes(OS string, hostSpecific bool) (map[string]bool, error) {
supportedTypes := make(map[string]bool)

if OS != "linux" && OS != "windows" {
logrus.Warnf("%v is not supported to check mount type", OS)
return nil, nil
} else if OS == "windows" {
supportedTypes["ntfs"] = true
if OS == "solaris" {
f, err := os.Open("/etc/vfstab")
if err != nil {
return nil, err
}
defer f.Close()

s := bufio.NewScanner(f)
for s.Scan() {
if err := s.Err(); err != nil {
return supportedTypes, err
}

text := s.Text()
parts := strings.Split(text, "\t")
if len(parts) > 1 {
supportedTypes[parts[1]] = true
} else {
supportedTypes[parts[0]] = true
}
}

return supportedTypes, nil
}

Expand Down

0 comments on commit 9e97695

Please sign in to comment.