summaryrefslogtreecommitdiff
path: root/pkg/specgenutil
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-09-10 07:40:39 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-09-10 07:52:00 -0400
commit2c63b8439bbdc09203ea394ad2cf9352830861f0 (patch)
tree39b9d8d061bc248e4dbeb6445c2ad0c99b048ae1 /pkg/specgenutil
parent2d8417d86a7edf11bce5527f311bb951a651d40e (diff)
downloadpodman-2c63b8439bbdc09203ea394ad2cf9352830861f0.tar.gz
podman-2c63b8439bbdc09203ea394ad2cf9352830861f0.tar.bz2
podman-2c63b8439bbdc09203ea394ad2cf9352830861f0.zip
Fix stutters
Podman adds an Error: to every error message. So starting an error message with "error" ends up being reported to the user as Error: error ... This patch removes the stutter. Also ioutil.ReadFile errors report the Path, so wrapping the err message with the path causes a stutter. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/specgenutil')
-rw-r--r--pkg/specgenutil/specgen.go2
-rw-r--r--pkg/specgenutil/util.go6
-rw-r--r--pkg/specgenutil/volumes.go2
3 files changed, 5 insertions, 5 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 3189926b2..2695d8873 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -762,7 +762,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
}
retries, err := strconv.Atoi(splitRestart[1])
if err != nil {
- return fmt.Errorf("error parsing restart policy retry count: %w", err)
+ return fmt.Errorf("parsing restart policy retry count: %w", err)
}
if retries < 0 {
return errors.New("must specify restart policy retry count as a number greater than 0")
diff --git a/pkg/specgenutil/util.go b/pkg/specgenutil/util.go
index 66d148672..b14e2a032 100644
--- a/pkg/specgenutil/util.go
+++ b/pkg/specgenutil/util.go
@@ -20,7 +20,7 @@ import (
func ReadPodIDFile(path string) (string, error) {
content, err := ioutil.ReadFile(path)
if err != nil {
- return "", fmt.Errorf("error reading pod ID file: %w", err)
+ return "", fmt.Errorf("reading pod ID file: %w", err)
}
return strings.Split(string(content), "\n")[0], nil
}
@@ -165,7 +165,7 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
}
ctrStart, ctrLen, err := parseAndValidateRange(ctrPort)
if err != nil {
- return newPort, fmt.Errorf("error parsing container port: %w", err)
+ return newPort, fmt.Errorf("parsing container port: %w", err)
}
newPort.ContainerPort = ctrStart
newPort.Range = ctrLen
@@ -197,7 +197,7 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
} else {
hostStart, hostLen, err := parseAndValidateRange(*hostPort)
if err != nil {
- return newPort, fmt.Errorf("error parsing host port: %w", err)
+ return newPort, fmt.Errorf("parsing host port: %w", err)
}
if hostLen != ctrLen {
return newPort, fmt.Errorf("host and container port ranges have different lengths: %d vs %d", hostLen, ctrLen)
diff --git a/pkg/specgenutil/volumes.go b/pkg/specgenutil/volumes.go
index e9fffdca9..e6c5d8b97 100644
--- a/pkg/specgenutil/volumes.go
+++ b/pkg/specgenutil/volumes.go
@@ -125,7 +125,7 @@ func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bo
if mount.Type == define.TypeBind {
absSrc, err := specgen.ConvertWinMountPath(mount.Source)
if err != nil {
- return nil, nil, nil, nil, fmt.Errorf("error getting absolute path of %s: %w", mount.Source, err)
+ return nil, nil, nil, nil, fmt.Errorf("getting absolute path of %s: %w", mount.Source, err)
}
mount.Source = absSrc
}