summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/pods.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-09-25 10:09:16 -0700
committerJhon Honce <jhonce@redhat.com>2018-10-01 07:24:50 -0700
commit9074565f4e623124f17ce02657e35d658abafae5 (patch)
tree6177fa9a72650f6d5ce4cdc2dca0b86dc17c69cd /pkg/varlinkapi/pods.go
parentdf978a264d7944351e7cded0a9506cab8a7bb0db (diff)
downloadpodman-9074565f4e623124f17ce02657e35d658abafae5.tar.gz
podman-9074565f4e623124f17ce02657e35d658abafae5.tar.bz2
podman-9074565f4e623124f17ce02657e35d658abafae5.zip
Implement pod varlink bindings
* Update varlink document * Add NoContainersInPod error in go and python * Add support for varlink pod interface * New code passes pylint * Fix bug in test_runner.sh * Update integration tests for race condition on status check * Add missing port config file support Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/pods.go')
-rw-r--r--pkg/varlinkapi/pods.go14
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 {