mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fbfac21ed4
Add a --dns-search parameter and a DnsSearch configuration field for specifying dns search domains. Docker-DCO-1.1-Signed-off-by: Daniel Norberg <daniel.norberg@gmail.com> (github: danielnorberg)
73 lines
1.6 KiB
Go
73 lines
1.6 KiB
Go
package runconfig
|
|
|
|
// Compare two Config struct. Do not compare the "Image" nor "Hostname" fields
|
|
// If OpenStdin is set, then it differs
|
|
func Compare(a, b *Config) bool {
|
|
if a == nil || b == nil ||
|
|
a.OpenStdin || b.OpenStdin {
|
|
return false
|
|
}
|
|
if a.AttachStdout != b.AttachStdout ||
|
|
a.AttachStderr != b.AttachStderr ||
|
|
a.User != b.User ||
|
|
a.Memory != b.Memory ||
|
|
a.MemorySwap != b.MemorySwap ||
|
|
a.CpuShares != b.CpuShares ||
|
|
a.OpenStdin != b.OpenStdin ||
|
|
a.Tty != b.Tty ||
|
|
a.VolumesFrom != b.VolumesFrom {
|
|
return false
|
|
}
|
|
if len(a.Cmd) != len(b.Cmd) ||
|
|
len(a.Dns) != len(b.Dns) ||
|
|
len(a.DnsSearch) != len(b.DnsSearch) ||
|
|
len(a.Env) != len(b.Env) ||
|
|
len(a.PortSpecs) != len(b.PortSpecs) ||
|
|
len(a.ExposedPorts) != len(b.ExposedPorts) ||
|
|
len(a.Entrypoint) != len(b.Entrypoint) ||
|
|
len(a.Volumes) != len(b.Volumes) {
|
|
return false
|
|
}
|
|
|
|
for i := 0; i < len(a.Cmd); i++ {
|
|
if a.Cmd[i] != b.Cmd[i] {
|
|
return false
|
|
}
|
|
}
|
|
for i := 0; i < len(a.Dns); i++ {
|
|
if a.Dns[i] != b.Dns[i] {
|
|
return false
|
|
}
|
|
}
|
|
for i := 0; i < len(a.DnsSearch); i++ {
|
|
if a.DnsSearch[i] != b.DnsSearch[i] {
|
|
return false
|
|
}
|
|
}
|
|
for i := 0; i < len(a.Env); i++ {
|
|
if a.Env[i] != b.Env[i] {
|
|
return false
|
|
}
|
|
}
|
|
for i := 0; i < len(a.PortSpecs); i++ {
|
|
if a.PortSpecs[i] != b.PortSpecs[i] {
|
|
return false
|
|
}
|
|
}
|
|
for k := range a.ExposedPorts {
|
|
if _, exists := b.ExposedPorts[k]; !exists {
|
|
return false
|
|
}
|
|
}
|
|
for i := 0; i < len(a.Entrypoint); i++ {
|
|
if a.Entrypoint[i] != b.Entrypoint[i] {
|
|
return false
|
|
}
|
|
}
|
|
for key := range a.Volumes {
|
|
if _, exists := b.Volumes[key]; !exists {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|