2013-01-18 16:13:39 -08:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2013-05-14 22:37:35 +00:00
|
|
|
"github.com/dotcloud/docker/utils"
|
2013-01-18 16:13:39 -08:00
|
|
|
)
|
|
|
|
|
2013-05-02 00:49:23 -07:00
|
|
|
// Compare two Config struct. Do not compare the "Image" nor "Hostname" fields
|
|
|
|
// If OpenStdin is set, then it differs
|
|
|
|
func CompareConfig(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 ||
|
2013-05-07 11:16:30 -07:00
|
|
|
a.CpuShares != b.CpuShares ||
|
2013-05-02 00:49:23 -07:00
|
|
|
a.OpenStdin != b.OpenStdin ||
|
|
|
|
a.Tty != b.Tty {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if len(a.Cmd) != len(b.Cmd) ||
|
|
|
|
len(a.Dns) != len(b.Dns) ||
|
|
|
|
len(a.Env) != len(b.Env) ||
|
|
|
|
len(a.PortSpecs) != len(b.PortSpecs) {
|
|
|
|
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.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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
2013-05-14 22:37:35 +00:00
|
|
|
|
|
|
|
func GetKernelVersion() (*utils.KernelVersionInfo, error) {
|
|
|
|
return getKernelVersion()
|
|
|
|
}
|