From ec6b9eb956dab11b4a4ead20bfae755671d91add Mon Sep 17 00:00:00 2001 From: zhangxiaoyu-zidif Date: Thu, 4 Jan 2018 11:08:40 +0800 Subject: [PATCH] fix-binary-check-cephfs --- pkg/volume/cephfs/cephfs.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/volume/cephfs/cephfs.go b/pkg/volume/cephfs/cephfs.go index bbe681d71b5..59f72a248d1 100644 --- a/pkg/volume/cephfs/cephfs.go +++ b/pkg/volume/cephfs/cephfs.go @@ -331,9 +331,8 @@ func (cephfsMounter *cephfsMounter) checkFuseMount() bool { execute := cephfsMounter.plugin.host.GetExec(cephfsMounter.plugin.GetPluginName()) switch runtime.GOOS { case "linux": - retBytes, err := execute.Run("/bin/ls", "/sbin/mount.fuse.ceph") - if err == nil && string(retBytes) == "/sbin/mount.fuse.ceph\n" { - glog.V(4).Infof("/sbin/mount.fuse.ceph exists, it should be fuse mount") + if _, err := execute.Run("/usr/bin/test", "-x", "/sbin/mount.fuse.ceph"); err == nil { + glog.V(4).Infof("/sbin/mount.fuse.ceph exists, it should be fuse mount.") return true } return false @@ -356,7 +355,7 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error { payload := make(map[string]util.FileProjection, 1) var fileProjection util.FileProjection - keyring := fmt.Sprintf("[client.%s]\n", cephfsVolume.id) + "key = " + cephfsVolume.secret + "\n" + keyring := fmt.Sprintf("[client.%s]\nkey = %s\n", cephfsVolume.id, cephfsVolume.secret) fileProjection.Data = []byte(keyring) fileProjection.Mode = int32(0644)