diff --git a/pkg/daemon/ceph/osd/init.go b/pkg/daemon/ceph/osd/init.go index 63b469861..d69cedab2 100644 --- a/pkg/daemon/ceph/osd/init.go +++ b/pkg/daemon/ceph/osd/init.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "os" + "os/exec" "path" "path/filepath" @@ -89,6 +90,13 @@ func copyBinary(sourceDir, targetDir, filename string) error { targetPath := path.Join(targetDir, filename) logger.Infof("copying %s to %s", sourcePath, targetPath) + // Check if the source path exists, and look in PATH if it doesn't + if _, err := os.Stat(sourcePath); err != nil { + if sourcePath, err = exec.LookPath(filename); err != nil { + return err + } + } + // Check if the target path exists, and skip the copy if it does if _, err := os.Stat(targetPath); err == nil { return nil