diff options
author | haircommander <pehunt@redhat.com> | 2018-08-16 11:41:53 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-16 20:31:50 +0000 |
commit | c4fadaba6b46029c4c94ef7779eac73345cde07a (patch) | |
tree | 38d5163118d19b395c6575823e9900e32d21342a /pkg/varlinkapi/util.go | |
parent | 309a2a15aebad35be753e65485ef6e10c62ef8bb (diff) | |
download | podman-c4fadaba6b46029c4c94ef7779eac73345cde07a.tar.gz podman-c4fadaba6b46029c4c94ef7779eac73345cde07a.tar.bz2 podman-c4fadaba6b46029c4c94ef7779eac73345cde07a.zip |
Added helper function for libpod pod api calls
Signed-off-by: haircommander <pehunt@redhat.com>
Closes: #1275
Approved by: mheon
Diffstat (limited to 'pkg/varlinkapi/util.go')
-rw-r--r-- | pkg/varlinkapi/util.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go index e0b679934..a80c8db41 100644 --- a/pkg/varlinkapi/util.go +++ b/pkg/varlinkapi/util.go @@ -117,3 +117,19 @@ func makeListPod(pod *libpod.Pod, batchInfo shared.PsOptions) (iopodman.ListPodD } return listPod, nil } + +func handlePodCall(call iopodman.VarlinkCall, pod *libpod.Pod, ctrErrs map[string]error, err error) error { + if err != nil && ctrErrs == nil { + return call.ReplyErrorOccurred(err.Error()) + } + if ctrErrs != nil { + containerErrs := make([]iopodman.PodContainerErrorData, len(ctrErrs)) + for ctr, reason := range ctrErrs { + ctrErr := iopodman.PodContainerErrorData{Containerid: ctr, Reason: reason.Error()} + containerErrs = append(containerErrs, ctrErr) + } + return call.ReplyPodContainerError(pod.ID(), containerErrs) + } + + return nil +} |