mirror of https://github.com/kubernetes/kops.git
Checking actual versus expected instead of pointer comparison
This commit is contained in:
parent
7a5c5d26a9
commit
621b6f11e2
|
|
@ -105,28 +105,28 @@ func (s *Subnet) Run(context *fi.Context) error {
|
||||||
return fi.DefaultDeltaRunMethod(s, context)
|
return fi.DefaultDeltaRunMethod(s, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_ *Subnet) CheckChanges(a, e, changes *Subnet) error {
|
func (_ *Subnet) CheckChanges(actual, expected, changes *Subnet) error {
|
||||||
if a == nil {
|
if actual == nil {
|
||||||
if e.Name == nil {
|
if expected.Name == nil {
|
||||||
return fi.RequiredField("Name")
|
return fi.RequiredField("Name")
|
||||||
}
|
}
|
||||||
if e.Network == nil {
|
if expected.Network == nil {
|
||||||
return fi.RequiredField("Network")
|
return fi.RequiredField("Network")
|
||||||
}
|
}
|
||||||
if e.CIDR == nil {
|
if expected.CIDR == nil {
|
||||||
return fi.RequiredField("CIDR")
|
return fi.RequiredField("CIDR")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if changes.Name != nil {
|
if changes.Name != nil {
|
||||||
return fi.CannotChangeField("Name")
|
return fi.CannotChangeField("Name")
|
||||||
}
|
}
|
||||||
if e.DNSServers != nil {
|
if changes.DNSServers != nil {
|
||||||
return fi.CannotChangeField("DNSServers")
|
return fi.CannotChangeField("DNSServers")
|
||||||
}
|
}
|
||||||
if e.Network != nil {
|
if fi.StringValue(actual.Network.ID) != fi.StringValue(expected.Network.ID) {
|
||||||
return fi.CannotChangeField("Network")
|
return fi.CannotChangeField("Network")
|
||||||
}
|
}
|
||||||
if e.CIDR != nil {
|
if changes.CIDR != nil {
|
||||||
return fi.CannotChangeField("CIDR")
|
return fi.CannotChangeField("CIDR")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue