summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
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/domain/infra/abi
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/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/generate.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go
index fa0cfb389..8853303d5 100644
--- a/pkg/domain/infra/abi/generate.go
+++ b/pkg/domain/infra/abi/generate.go
@@ -16,8 +16,8 @@ import (
func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string, options entities.GenerateSystemdOptions) (*entities.GenerateSystemdReport, error) {
// First assume it's a container.
- ctr, err := ic.Libpod.LookupContainer(nameOrID)
- if err == nil {
+ ctr, ctrErr := ic.Libpod.LookupContainer(nameOrID)
+ if ctrErr == nil {
// Generate the unit for the container.
s, err := generate.ContainerUnit(ctr, options)
if err == nil {
@@ -28,7 +28,8 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string,
// If it's not a container, we either have a pod or garbage.
pod, err := ic.Libpod.LookupPod(nameOrID)
if err != nil {
- return nil, errors.Errorf("%q does not refer to a container or pod", nameOrID)
+ err = errors.Wrap(ctrErr, err.Error())
+ return nil, errors.Wrapf(err, "%s does not refer to a container or pod", nameOrID)
}
// Generate the units for the pod and all its containers.