Merge pull request #3326 from krig/rook-binary-location
ceph: Look for binaries on PATH if not found
This commit is contained in:
1 file changed
+8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user