Skip to content

Commit

Permalink
ceph: only merge stderr on error
Browse files Browse the repository at this point in the history
Previously we were merging the stderr even if it was empty, leading to
unmarshall errors.
The error simulation was done here
https://play.golang.org/p/Sk2yw9GUWNu.

Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Oct 18, 2021
1 parent ceae760 commit 47784b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/daemon/ceph/client/command.go
Expand Up @@ -164,7 +164,9 @@ func (c *CephToolCommand) run() ([]byte, error) {
if command == RBDTool {
if c.RemoteExecution {
output, stderr, err = c.context.RemoteExecutor.ExecCommandInContainerWithFullOutputWithTimeout(ProxyAppLabel, CommandProxyInitContainerName, c.clusterInfo.Namespace, append([]string{command}, args...)...)
output = fmt.Sprintf("%s. %s", output, stderr)
if stderr != "" || err != nil {
err = errors.Errorf("%s. %s", err.Error(), stderr)
}
} else if c.timeout == 0 {
output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...)
} else {
Expand Down

0 comments on commit 47784b7

Please sign in to comment.