diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/varlinkapi/pods.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go index d95b631f2..8b72492b0 100644 --- a/pkg/varlinkapi/pods.go +++ b/pkg/varlinkapi/pods.go @@ -104,6 +104,13 @@ func (i *LibpodAPI) StartPod(call iopodman.VarlinkCall, name string) error { if err != nil { return call.ReplyPodNotFound(name) } + ctnrs, err := pod.AllContainers() + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + if 0 == len(ctnrs) { + return call.ReplyNoContainersInPod(name) + } ctrErrs, err := pod.Start(getContext()) callErr := handlePodCall(call, pod, ctrErrs, err) if callErr != nil { @@ -132,6 +139,13 @@ func (i *LibpodAPI) RestartPod(call iopodman.VarlinkCall, name string) error { if err != nil { return call.ReplyPodNotFound(name) } + ctnrs, err := pod.AllContainers() + if err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + if 0 == len(ctnrs) { + return call.ReplyNoContainersInPod(name) + } ctrErrs, err := pod.Restart(getContext()) callErr := handlePodCall(call, pod, ctrErrs, err) if callErr != nil { |