mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
util: make ExecComand return stdout and stderr as string
Most consumers of util.ExecCommand() need to convert the returned []byte format of stdout and/or stderr to string. By having util.ExecCommand() return strings instead, the code gets a little simpler. A few commands return JSON that needs to be parsed. These commands will be replaced by go-ceph implementations later on. For now, convert the strings back to []byte when needed. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
ddac66d76b
commit
36469b87e2
@ -67,16 +67,15 @@ func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, cr *u
|
||||
"--keyfile="+cr.KeyFile)
|
||||
|
||||
if err != nil {
|
||||
stdErrString := string(stderr)
|
||||
klog.Errorf(util.Log(ctx, "failed to get the rootpath for the vol %s(%s) stdError %s"), string(volID), err, stdErrString)
|
||||
klog.Errorf(util.Log(ctx, "failed to get the rootpath for the vol %s(%s) stdError %s"), string(volID), err, stderr)
|
||||
|
||||
if strings.HasPrefix(stdErrString, errNotFoundString) {
|
||||
if strings.HasPrefix(stderr, errNotFoundString) {
|
||||
return "", util.JoinErrors(ErrVolumeNotFound, err)
|
||||
}
|
||||
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSuffix(string(stdout), "\n"), nil
|
||||
return strings.TrimSuffix(stdout, "\n"), nil
|
||||
}
|
||||
|
||||
type localClusterState struct {
|
||||
|
Reference in New Issue
Block a user