correct assignment of networkStatus

once we changed configureNetNS to return a result beyond an error,
we need to make sure that we used locals instead of ctr attributes
when determining networks.

Resolves #1752

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2018-11-08 13:45:11 -06:00
parent 85dbfb33f4
commit 46e672bad6

View File

@ -64,20 +64,20 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
}
}()
networkStatus := make([]*cnitypes.Result, 1)
networkStatus := make([]*cnitypes.Result, 0)
for idx, r := range results {
logrus.Debugf("[%d] CNI result: %v", idx, r.String())
resultCurrent, err := cnitypes.GetResult(r)
if err != nil {
return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.String(), err)
}
networkStatus = append(ctr.state.NetworkStatus, resultCurrent)
networkStatus = append(networkStatus, resultCurrent)
}
// Add firewall rules to ensure the container has network access.
// Will not be necessary once CNI firewall plugin merges upstream.
// https://github.com/containernetworking/plugins/pull/75
for _, netStatus := range ctr.state.NetworkStatus {
for _, netStatus := range networkStatus {
firewallConf := &firewall.FirewallNetConf{
PrevResult: netStatus,
}