summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/varlinkapi/containers.go3
-rw-r--r--pkg/varlinkapi/pods.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index 58452716a..f517e9b6e 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -207,6 +207,9 @@ func (i *LibpodAPI) GetContainerStats(call iopodman.VarlinkCall, name string) er
}
containerStats, err := ctr.GetContainerStats(&libpod.ContainerStats{})
if err != nil {
+ if errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ return call.ReplyNoContainerRunning()
+ }
return call.ReplyErrorOccurred(err.Error())
}
cs := iopodman.ContainerStats{
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index 75733db11..9e49ab687 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -199,6 +199,9 @@ func (i *LibpodAPI) GetPodStats(call iopodman.VarlinkCall, name string) error {
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
+ if len(podStats) == 0 {
+ return call.ReplyNoContainerRunning()
+ }
containersStats := make([]iopodman.ContainerStats, 0)
for ctrID, containerStats := range podStats {
cs := iopodman.ContainerStats{