aboutsummaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/containers.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-08 09:24:25 +0000
committerGitHub <noreply@github.com>2022-07-08 09:24:25 +0000
commit6087fb2116aaeae995e8423872ffe637e8be128f (patch)
treee8bd00a9b325a51a49de02e868f06eec2deeb529 /pkg/systemd/generate/containers.go
parenta2bcf833c98cb38eb28dc65a8768963d0b7344fc (diff)
parenta46f798831df06c472b288db7b34de8536a7ea5a (diff)
downloadpodman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.gz
podman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.bz2
podman-6087fb2116aaeae995e8423872ffe637e8be128f.zip
Merge pull request #14839 from saschagrunert/errors-pkg
pkg: switch to golang native error wrapping
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r--pkg/systemd/generate/containers.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index e953a1f1f..6596ef73b 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -2,6 +2,7 @@ package generate
import (
"bytes"
+ "errors"
"fmt"
"os"
"sort"
@@ -14,7 +15,6 @@ import (
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/systemd/define"
"github.com/containers/podman/v4/version"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
)
@@ -186,14 +186,14 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
config := ctr.Config()
conmonPidFile := config.ConmonPidFile
if conmonPidFile == "" {
- return nil, errors.Errorf("conmon PID file path is empty, try to recreate the container with --conmon-pidfile flag")
+ return nil, errors.New("conmon PID file path is empty, try to recreate the container with --conmon-pidfile flag")
}
createCommand := []string{}
if config.CreateCommand != nil {
createCommand = config.CreateCommand
} else if options.New {
- return nil, errors.Errorf("cannot use --new on container %q: no create command found: only works on containers created directly with podman but not via REST API", ctr.ID())
+ return nil, fmt.Errorf("cannot use --new on container %q: no create command found: only works on containers created directly with podman but not via REST API", ctr.ID())
}
nameOrID, serviceName := containerServiceName(ctr, options)
@@ -204,7 +204,7 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
} else {
runRoot = ctr.Runtime().RunRoot()
if runRoot == "" {
- return nil, errors.Errorf("could not look up container's runroot: got empty string")
+ return nil, errors.New("could not look up container's runroot: got empty string")
}
}
@@ -350,7 +350,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
}
}
if index == 0 {
- return "", errors.Errorf("container's create command is too short or invalid: %v", info.CreateCommand)
+ return "", fmt.Errorf("container's create command is too short or invalid: %v", info.CreateCommand)
}
// We're hard-coding the first five arguments and append the
// CreateCommand with a stripped command and subcommand.
@@ -520,7 +520,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
// template execution.
templ, err := template.New("container_template").Delims("{{{{", "}}}}").Parse(containerTemplate)
if err != nil {
- return "", errors.Wrap(err, "error parsing systemd service template")
+ return "", fmt.Errorf("error parsing systemd service template: %w", err)
}
var buf bytes.Buffer
@@ -531,7 +531,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
// Now parse the generated template (i.e., buf) and execute it.
templ, err = template.New("container_template").Delims("{{{{", "}}}}").Parse(buf.String())
if err != nil {
- return "", errors.Wrap(err, "error parsing systemd service template")
+ return "", fmt.Errorf("error parsing systemd service template: %w", err)
}
buf = bytes.Buffer{}