forked from Ivasoft/objectivefs-docker-volume
Revert lenient path checking and disable the check altogether for debugging
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
11
main.go
11
main.go
@@ -406,9 +406,11 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error)
|
||||
}
|
||||
|
||||
// Check for mount
|
||||
if isObjfs, err := isObjectiveFsMount(mountPath); err == nil && isObjfs {
|
||||
break
|
||||
}
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
break
|
||||
//if isObjfs, err := isObjectiveFsMount(mountPath); err == nil && isObjfs {
|
||||
// break
|
||||
//}
|
||||
}
|
||||
|
||||
log.WithFields(log.Fields{"name": r.Name}).Info("Volume mounted")
|
||||
@@ -814,13 +816,12 @@ func getMountedSnaphots(baseDir string, checkMount bool) (map[string]string, err
|
||||
}
|
||||
|
||||
func isObjectiveFsMount(path string) (bool, error) {
|
||||
nameToMatch := filepath.Base(path)
|
||||
mount := exec.Command("df", "--output=target", "-t", "fuse.objectivefs", path)
|
||||
if data, err := mount.CombinedOutput(); err == nil {
|
||||
scanner := bufio.NewScanner(strings.NewReader(string(data)))
|
||||
// On success the first line contains column headers (in our case "Mounted on")
|
||||
// and the second line contains the nearest mount point on the root path
|
||||
return scanner.Scan() && scanner.Scan() && filepath.Base(strings.TrimSpace(scanner.Text())) == nameToMatch, nil
|
||||
return scanner.Scan() && scanner.Scan() && strings.TrimSpace(scanner.Text()) == path, nil
|
||||
} else {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user