mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Merge pull request #55992 from zhangxiaoyu-zidif/fix-binary-check-nfs
Automatic merge from submit-queue (batch tested with PRs 55925, 55999, 55944, 55992, 56196). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fix binary check for nfs.go **What this PR does / why we need it**: err check can't show that the binary does not exist. If the binary does not exist, the err still be nil ever. we should add print check to show if the binary exist. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes https://github.com/kubernetes/kubernetes/issues/56479 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
f2ff2da235
@ -194,15 +194,15 @@ func (nfsMounter *nfsMounter) CanMount() error {
|
||||
exec := nfsMounter.plugin.host.GetExec(nfsMounter.plugin.GetPluginName())
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount.nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs is missing")
|
||||
}
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs4"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount.nfs4"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount.nfs4 is missing")
|
||||
}
|
||||
return nil
|
||||
case "darwin":
|
||||
if _, err := exec.Run("/bin/ls", "/sbin/mount_nfs"); err != nil {
|
||||
if _, err := exec.Run("test", "-x", "/sbin/mount_nfs"); err != nil {
|
||||
return fmt.Errorf("Required binary /sbin/mount_nfs is missing")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user