summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-06-10 11:05:41 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-06-11 11:01:13 +0200
commit05713fbbf30a8c10f9aa290723efec5f3846a113 (patch)
tree2e12f8bc857ea3151bc5da767b8c50399734d9b8 /pkg/systemd/generate
parent139f82933deceda569c30d3364bba585fa925f5a (diff)
downloadpodman-05713fbbf30a8c10f9aa290723efec5f3846a113.tar.gz
podman-05713fbbf30a8c10f9aa290723efec5f3846a113.tar.bz2
podman-05713fbbf30a8c10f9aa290723efec5f3846a113.zip
generate systemd: wrap pod/ctr lookup errors
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate')
-rw-r--r--pkg/systemd/generate/common.go2
-rw-r--r--pkg/systemd/generate/pods.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index 4f995be96..fe56dc874 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -41,7 +41,7 @@ func filterPodFlags(command []string) []string {
for i := 0; i < len(command); i++ {
s := command[i]
if s == "--pod" || s == "--pod-id-file" {
- i += 1
+ i++
continue
}
processed = append(processed, s)
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go
index 355103df8..5cfd5ab0a 100644
--- a/pkg/systemd/generate/pods.go
+++ b/pkg/systemd/generate/pods.go
@@ -99,7 +99,7 @@ func PodUnits(pod *libpod.Pod, options entities.GenerateSystemdOptions) (string,
// Error out if the pod has no infra container, which we require to be the
// main service.
if !pod.HasInfraContainer() {
- return "", fmt.Errorf("error generating systemd unit files: Pod %q has no infra container", pod.Name())
+ return "", errors.Errorf("error generating systemd unit files: Pod %q has no infra container", pod.Name())
}
podInfo, err := generatePodInfo(pod, options)
@@ -118,7 +118,7 @@ func PodUnits(pod *libpod.Pod, options entities.GenerateSystemdOptions) (string,
return "", err
}
if len(containers) == 0 {
- return "", fmt.Errorf("error generating systemd unit files: Pod %q has no containers", pod.Name())
+ return "", errors.Errorf("error generating systemd unit files: Pod %q has no containers", pod.Name())
}
graph, err := libpod.BuildContainerGraph(containers)
if err != nil {