diff --git a/hnsendpoint.go b/hnsendpoint.go index 92afc0c249..de736a092b 100644 --- a/hnsendpoint.go +++ b/hnsendpoint.go @@ -192,18 +192,24 @@ func (endpoint *HNSEndpoint) ContainerHotDetach(containerID string) error { return modifyNetworkEndpoint(containerID, endpoint.Id, Remove) } -// ApplyACLPolicy applies Acl Policy on the Endpoint -func (endpoint *HNSEndpoint) ApplyACLPolicy(policy *ACLPolicy) error { +// ApplyACLPolicy applies a set of ACL Policies on the Endpoint +func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error { operation := "ApplyACLPolicy" title := "HCSShim::HNSEndpoint::" + operation logrus.Debugf(title+" id=%s", endpoint.Id) - jsonString, err := json.Marshal(policy) - if err != nil { - return err + for _, policy := range policies { + if policy == nil { + continue + } + jsonString, err := json.Marshal(policy) + if err != nil { + return err + } + endpoint.Policies = append(endpoint.Policies, jsonString) } - endpoint.Policies[0] = jsonString - _, err = endpoint.Update() + + _, err := endpoint.Update() return err }