Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph: only merge stderr on error #8995

Merged
merged 1 commit into from Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {
travisn marked this conversation as resolved.
Show resolved Hide resolved
err = errors.Errorf("%s. %s", err.Error(), stderr)
}
} else if c.timeout == 0 {
output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/ceph/client/command_test.go
Expand Up @@ -140,7 +140,7 @@ func TestNewRBDCommand(t *testing.T) {
assert.Error(t, err)
assert.Len(t, cmd.args, 4)
// This is not the best but it shows we go through the right codepath
assert.EqualError(t, err, "no pods found with selector \"rook-ceph-mgr\"")
assert.Contains(t, err.Error(), "no pods found with selector \"rook-ceph-mgr\"")
})

t.Run("context canceled nothing to run", func(t *testing.T) {
Expand Down