summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-12-13 15:00:47 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 01:29:48 +0000
commit900afc929f01ef2a38b69263e35c964284f1f9f4 (patch)
treef5fabf5e27c164d5e7df04328a8c4a12ae157962
parentf82030941344f7993f8f7018cb601847ec2dfd08 (diff)
downloadpodman-900afc929f01ef2a38b69263e35c964284f1f9f4.tar.gz
podman-900afc929f01ef2a38b69263e35c964284f1f9f4.tar.bz2
podman-900afc929f01ef2a38b69263e35c964284f1f9f4.zip
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
-rw-r--r--cmd/kpod/inspect.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd/kpod/inspect.go b/cmd/kpod/inspect.go
index e2f9ec97e..e3387841b 100644
--- a/cmd/kpod/inspect.go
+++ b/cmd/kpod/inspect.go
@@ -7,6 +7,7 @@ import (
"github.com/pkg/errors"
"github.com/projectatomic/libpod/cmd/kpod/formats"
"github.com/projectatomic/libpod/libpod"
+ "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -138,13 +139,14 @@ func getCtrInspectInfo(ctr *libpod.Container, ctrInspectData *libpod.ContainerIn
pidsLimit := getPidsInfo(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
- if err := json.Unmarshal(artifact, &createArtifact); err != nil {
- return nil, err
+ artifact, err := ctr.GetArtifact("create-config")
+ 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{