nfs: Use VolumeHost.GetExec() to execute stuff in volume plugins

pull/6/head
Jan Safranek 2017-08-22 15:17:07 +02:00
parent 07dea6b447
commit 85495bd102
2 changed files with 4 additions and 6 deletions

View File

@ -21,7 +21,6 @@ go_library(
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/utils/exec:go_default_library",
],
)

View File

@ -29,7 +29,6 @@ import (
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
)
// This is the primary entrypoint for volume plugins.
@ -192,18 +191,18 @@ func (nfsVolume *nfs) GetPath() string {
// to mount the volume are available on the underlying node.
// If not, it returns an error
func (nfsMounter *nfsMounter) CanMount() error {
exe := exec.New()
exec := nfsMounter.plugin.host.GetExec(nfsMounter.plugin.GetPluginName())
switch runtime.GOOS {
case "linux":
if _, err := exe.Command("/bin/ls", "/sbin/mount.nfs").CombinedOutput(); err != nil {
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs"); err != nil {
return fmt.Errorf("Required binary /sbin/mount.nfs is missing")
}
if _, err := exe.Command("/bin/ls", "/sbin/mount.nfs4").CombinedOutput(); err != nil {
if _, err := exec.Run("/bin/ls", "/sbin/mount.nfs4"); err != nil {
return fmt.Errorf("Required binary /sbin/mount.nfs4 is missing")
}
return nil
case "darwin":
if _, err := exe.Command("/bin/ls", "/sbin/mount_nfs").CombinedOutput(); err != nil {
if _, err := exec.Run("/bin/ls", "/sbin/mount_nfs"); err != nil {
return fmt.Errorf("Required binary /sbin/mount_nfs is missing")
}
}