diff --git a/pkg/daemon/ceph/client/command.go b/pkg/daemon/ceph/client/command.go index 88646c486563..068b1ede7639 100644 --- a/pkg/daemon/ceph/client/command.go +++ b/pkg/daemon/ceph/client/command.go @@ -96,16 +96,18 @@ type CephToolCommand struct { args []string timeout time.Duration JsonOutput bool + combinedOutput bool RemoteExecution bool } func newCephToolCommand(tool string, context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand { return &CephToolCommand{ - context: context, - tool: tool, - clusterInfo: clusterInfo, - args: args, - JsonOutput: true, + context: context, + tool: tool, + clusterInfo: clusterInfo, + args: args, + JsonOutput: true, + combinedOutput: false, } } @@ -168,7 +170,11 @@ func (c *CephToolCommand) run() ([]byte, error) { output, err = c.context.Executor.ExecuteCommandWithTimeout(c.timeout, command, args...) } } else if c.timeout == 0 { - output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...) + if c.combinedOutput { + output, err = c.context.Executor.ExecuteCommandWithCombinedOutput(command, args...) + } else { + output, err = c.context.Executor.ExecuteCommandWithOutput(command, args...) + } } else { output, err = c.context.Executor.ExecuteCommandWithTimeout(c.timeout, command, args...) } diff --git a/pkg/daemon/ceph/client/filesystem_mirror.go b/pkg/daemon/ceph/client/filesystem_mirror.go index dfe6151cc01f..c1386c4c7216 100644 --- a/pkg/daemon/ceph/client/filesystem_mirror.go +++ b/pkg/daemon/ceph/client/filesystem_mirror.go @@ -170,8 +170,10 @@ func ImportFSMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *Cluster logger.Infof("importing cephfs bootstrap peer token for filesystem %q", fsName) // Build command - args := []string{"fs", "snapshot", "mirror", "peer_bootstrap", "import", fsName, token} + args := []string{"fs", "snapshot", "mirror", "peer_bootstrap", "import", fsName, strings.TrimSpace(token)} cmd := NewCephCommand(context, clusterInfo, args) + cmd.JsonOutput = false + cmd.combinedOutput = true // Run command output, err := cmd.Run()