diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-28 17:46:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 17:46:12 +0000 |
commit | d8f197cc1491dace1ff12bff281d9adfbfd35761 (patch) | |
tree | cae59afd4e9f31f1859e24617643c3d0939ca249 /cmd/podman/system/connection/shared.go | |
parent | 50fa651a4e3cfde2b64aa818ad1009f4289f0afd (diff) | |
parent | 6d3520e8b7d7f57d389da08d1c8104c2cfbdd016 (diff) | |
download | podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.tar.gz podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.tar.bz2 podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.zip |
Merge pull request #14400 from cdoern/scp
podman image scp remote support & podman image scp tagging
Diffstat (limited to 'cmd/podman/system/connection/shared.go')
-rw-r--r-- | cmd/podman/system/connection/shared.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/cmd/podman/system/connection/shared.go b/cmd/podman/system/connection/shared.go deleted file mode 100644 index 714ae827d..000000000 --- a/cmd/podman/system/connection/shared.go +++ /dev/null @@ -1,27 +0,0 @@ -package connection - -import ( - "bytes" - - "github.com/pkg/errors" - "golang.org/x/crypto/ssh" -) - -// 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) ([]byte, error) { - sess, err := dial.NewSession() // new ssh client session - if err != nil { - return nil, err - } - defer sess.Close() - - var buffer bytes.Buffer - var bufferErr bytes.Buffer - 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 nil, errors.Wrapf(err, bufferErr.String()) - } - return buffer.Bytes(), nil -} |