summaryrefslogtreecommitdiff
path: root/cmd/podman/system/connection
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-11-17 07:02:11 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2020-11-17 09:19:22 -0500
commit389dcb5c29d926e89d5d4c0b26ebf434c2fe5dcb (patch)
treef3970765fe109233dd441da8a7c5b3b5da3e945e /cmd/podman/system/connection
parent7d067afac716927b26c452d4d75478b9f13abd62 (diff)
downloadpodman-389dcb5c29d926e89d5d4c0b26ebf434c2fe5dcb.tar.gz
podman-389dcb5c29d926e89d5d4c0b26ebf434c2fe5dcb.tar.bz2
podman-389dcb5c29d926e89d5d4c0b26ebf434c2fe5dcb.zip
Remove some more excessive wrapping and stuttering
Stop over wrapping API Calls The API calls will return an appropriate error, and this wrapping just makes the error message look like it is stuttering and a big mess. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/system/connection')
-rw-r--r--cmd/podman/system/connection/add.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index b3a23bffd..57e747451 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -79,14 +79,14 @@ func add(cmd *cobra.Command, args []string) error {
// Default to ssh: schema if none given
dest := args[1]
if match, err := regexp.Match(schemaPattern, []byte(dest)); err != nil {
- return errors.Wrapf(err, "internal regex error %q", schemaPattern)
+ return errors.Wrapf(err, "invalid destination")
} else if !match {
dest = "ssh://" + dest
}
uri, err := url.Parse(dest)
if err != nil {
- return errors.Wrapf(err, "failed to parse %q", dest)
+ return err
}
if uri.User.Username() == "" {
@@ -109,7 +109,7 @@ func add(cmd *cobra.Command, args []string) error {
if uri.Path == "" || uri.Path == "/" {
if uri.Path, err = getUDS(cmd, uri); err != nil {
- return errors.Wrapf(err, "failed to connect to %q", uri.String())
+ return err
}
}
@@ -151,7 +151,7 @@ func getUserInfo(uri *url.URL) (*url.Userinfo, error) {
if u, found := os.LookupEnv("_CONTAINERS_ROOTLESS_UID"); found {
usr, err = user.LookupId(u)
if err != nil {
- return nil, errors.Wrapf(err, "failed to find user %q", u)
+ return nil, errors.Wrapf(err, "failed to lookup rootless user")
}
} else {
usr, err = user.Current()
@@ -209,7 +209,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
}
dial, err := ssh.Dial("tcp", uri.Host, cfg)
if err != nil {
- return "", errors.Wrapf(err, "failed to connect to %q", uri.Host)
+ return "", errors.Wrapf(err, "failed to connect")
}
defer dial.Close()
@@ -229,7 +229,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
var buffer bytes.Buffer
session.Stdout = &buffer
if err := session.Run(run); err != nil {
- return "", errors.Wrapf(err, "failed to run %q", run)
+ return "", err
}
var info define.Info
@@ -238,7 +238,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
}
if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
- return "", fmt.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
+ return "", errors.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
}
return info.Host.RemoteSocket.Path, nil
}