mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Handle artifacts not found more gracefully
If the artifacts file "create-config" is not found when doing kpod inspect, just print the error and move on to print out the rest of the inspect info Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #134 Approved by: mheon
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/projectatomic/libpod/cmd/kpod/formats"
|
"github.com/projectatomic/libpod/cmd/kpod/formats"
|
||||||
"github.com/projectatomic/libpod/libpod"
|
"github.com/projectatomic/libpod/libpod"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -138,13 +139,14 @@ func getCtrInspectInfo(ctr *libpod.Container, ctrInspectData *libpod.ContainerIn
|
|||||||
pidsLimit := getPidsInfo(spec)
|
pidsLimit := getPidsInfo(spec)
|
||||||
cgroup := getCgroup(spec)
|
cgroup := getCgroup(spec)
|
||||||
|
|
||||||
artifact, err := ctr.GetArtifact("create-config")
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.Wrapf(err, "error getting artifact %q", ctr.ID())
|
|
||||||
}
|
|
||||||
var createArtifact createConfig
|
var createArtifact createConfig
|
||||||
if err := json.Unmarshal(artifact, &createArtifact); err != nil {
|
artifact, err := ctr.GetArtifact("create-config")
|
||||||
return nil, err
|
if err == nil {
|
||||||
|
if err := json.Unmarshal(artifact, &createArtifact); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logrus.Errorf("couldn't get some inspect information, error getting artifact %q: %v", ctr.ID(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := &ContainerData{
|
data := &ContainerData{
|
||||||
|
Reference in New Issue
Block a user