summaryrefslogtreecommitdiff
path: root/cmd/podman/system/connection/shared.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-10-18 07:47:46 -0700
committerJhon Honce <jhonce@redhat.com>2021-11-08 09:20:58 -0700
commite907f095b24632ebf25348bc17ba3ff3468a979b (patch)
tree93a662f566dca3363e77e680ff75c0bfbc1097e2 /cmd/podman/system/connection/shared.go
parent22ef488d246effddbb3f390dd3fd048dc0f5fe82 (diff)
downloadpodman-e907f095b24632ebf25348bc17ba3ff3468a979b.tar.gz
podman-e907f095b24632ebf25348bc17ba3ff3468a979b.tar.bz2
podman-e907f095b24632ebf25348bc17ba3ff3468a979b.zip
test connection add
* Fix connection JSON encoding * Add custom ginkgo matchers for connection testing * Cleanup code Fixes #11984 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/system/connection/shared.go')
-rw-r--r--cmd/podman/system/connection/shared.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/podman/system/connection/shared.go b/cmd/podman/system/connection/shared.go
index 3fd7c59fb..714ae827d 100644
--- a/cmd/podman/system/connection/shared.go
+++ b/cmd/podman/system/connection/shared.go
@@ -9,10 +9,10 @@ import (
// ExecRemoteCommand takes a ssh client connection and a command to run and executes the
// command on the specified client. The function returns the Stdout from the client or the Stderr
-func ExecRemoteCommand(dial *ssh.Client, run string) (string, error) {
+func ExecRemoteCommand(dial *ssh.Client, run string) ([]byte, error) {
sess, err := dial.NewSession() // new ssh client session
if err != nil {
- return "", err
+ return nil, err
}
defer sess.Close()
@@ -21,8 +21,7 @@ func ExecRemoteCommand(dial *ssh.Client, run string) (string, error) {
sess.Stdout = &buffer // output from client funneled into buffer
sess.Stderr = &bufferErr // err form client funneled into buffer
if err := sess.Run(run); err != nil { // run the command on the ssh client
- return "", errors.Wrapf(err, bufferErr.String())
+ return nil, errors.Wrapf(err, bufferErr.String())
}
- out := buffer.String() // output from command
- return out, nil
+ return buffer.Bytes(), nil
}