aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-02 12:31:12 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-02 19:20:26 +0000
commit02c6ba994949e2c5b606df56d43e923d9b044f67 (patch)
treef90998f45e365b6c72098b84b9c4059c824a50aa /libpod
parentedb1609c6121a550a3c882529e44387c217d2b03 (diff)
downloadpodman-02c6ba994949e2c5b606df56d43e923d9b044f67.tar.gz
podman-02c6ba994949e2c5b606df56d43e923d9b044f67.tar.bz2
podman-02c6ba994949e2c5b606df56d43e923d9b044f67.zip
Use more reliable function for parsing CNI result
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #440 Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r--libpod/networking.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/libpod/networking.go b/libpod/networking.go
index f92b80201..a508cd7b4 100644
--- a/libpod/networking.go
+++ b/libpod/networking.go
@@ -42,9 +42,20 @@ func (r *Runtime) createNetNS(ctr *Container) (err error) {
if err != nil {
return errors.Wrapf(err, "error configuring network namespace for container %s", ctr.ID())
}
+ defer func() {
+ if err != nil {
+ if err2 := r.netPlugin.TearDownPod(podNetwork); err2 != nil {
+ logrus.Errorf("Error tearing down partially created network namespace for container %s: %v", ctr.ID(), err2)
+ }
+ }
+ }()
+
+ logrus.Debugf("Response from CNI plugins: %v", result.String())
- resultStruct := result.(*cnitypes.Result)
- logrus.Debugf("Response from CNI plugins: %v", resultStruct.String())
+ resultStruct, err := cnitypes.GetResult(result)
+ if err != nil {
+ return errors.Wrapf(err, "error parsing result from CBI plugins")
+ }
ctr.state.NetNS = ctrNS
ctr.state.IPs = resultStruct.IPs