1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Tidy driver.go/LinkContainers

Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
This commit is contained in:
Ian Bishop 2014-12-21 13:42:02 +10:00
parent 137ceae913
commit 38a595aec5

View file

@ -509,7 +509,6 @@ func LinkContainers(job *engine.Job) engine.Status {
parentIP = job.Getenv("ParentIP") parentIP = job.Getenv("ParentIP")
ignoreErrors = job.GetenvBool("IgnoreErrors") ignoreErrors = job.GetenvBool("IgnoreErrors")
ports = job.GetenvList("Ports") ports = job.GetenvList("Ports")
chain = iptables.Chain{}
) )
switch action { switch action {
@ -532,14 +531,11 @@ func LinkContainers(job *engine.Job) engine.Status {
return job.Errorf("child IP '%s' is invalid", childIP) return job.Errorf("child IP '%s' is invalid", childIP)
} }
chain.Name = "DOCKER" chain := iptables.Chain{Name: "DOCKER", Bridge: bridgeIface}
chain.Bridge = bridgeIface
for _, p := range ports { for _, p := range ports {
port := nat.Port(p) port := nat.Port(p)
if err := chain.Link(nfAction, ip1, ip2, port.Int(), port.Proto()); !ignoreErrors && err != nil { if err := chain.Link(nfAction, ip1, ip2, port.Int(), port.Proto()); !ignoreErrors && err != nil {
fmt.Print(err)
return job.Error(err) return job.Error(err)
} }
} }
return engine.StatusOK return engine.StatusOK