mirror of https://github.com/k3s-io/k3s
Fix route53 stub matching logic: match name & type
parent
6463a220ee
commit
756c17315b
|
@ -76,17 +76,18 @@ func (r *Route53APIStub) ChangeResourceRecordSets(input *route53.ChangeResourceR
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, change := range input.ChangeBatch.Changes {
|
for _, change := range input.ChangeBatch.Changes {
|
||||||
|
key := *change.ResourceRecordSet.Name + "::" + *change.ResourceRecordSet.Type
|
||||||
switch *change.Action {
|
switch *change.Action {
|
||||||
case route53.ChangeActionCreate:
|
case route53.ChangeActionCreate:
|
||||||
if _, found := recordSets[*change.ResourceRecordSet.Name]; found {
|
if _, found := recordSets[key]; found {
|
||||||
return nil, fmt.Errorf("Attempt to create duplicate rrset %s", *change.ResourceRecordSet.Name) // TODO: Return AWS errors with codes etc
|
return nil, fmt.Errorf("Attempt to create duplicate rrset %s", key) // TODO: Return AWS errors with codes etc
|
||||||
}
|
}
|
||||||
recordSets[*change.ResourceRecordSet.Name] = append(recordSets[*change.ResourceRecordSet.Name], change.ResourceRecordSet)
|
recordSets[key] = append(recordSets[key], change.ResourceRecordSet)
|
||||||
case route53.ChangeActionDelete:
|
case route53.ChangeActionDelete:
|
||||||
if _, found := recordSets[*change.ResourceRecordSet.Name]; !found {
|
if _, found := recordSets[key]; !found {
|
||||||
return nil, fmt.Errorf("Attempt to delete non-existant rrset %s", *change.ResourceRecordSet.Name) // TODO: Check other fields too
|
return nil, fmt.Errorf("Attempt to delete non-existant rrset %s", key) // TODO: Check other fields too
|
||||||
}
|
}
|
||||||
delete(recordSets, *change.ResourceRecordSet.Name)
|
delete(recordSets, key)
|
||||||
case route53.ChangeActionUpsert:
|
case route53.ChangeActionUpsert:
|
||||||
// TODO - not used yet
|
// TODO - not used yet
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ func CommonTestResourceRecordSetsDifferentTypes(t *testing.T, zone dnsprovider.Z
|
||||||
// Add the resource with the same name but different type
|
// Add the resource with the same name but different type
|
||||||
err := sets.StartChangeset().Add(cnameRrset).Apply()
|
err := sets.StartChangeset().Add(cnameRrset).Apply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to add resource record set %v: %v", rrset, cnameRrset, err)
|
t.Errorf("Failed to add resource record set %v: %v", cnameRrset, err)
|
||||||
}
|
}
|
||||||
defer sets.StartChangeset().Remove(cnameRrset).Apply()
|
defer sets.StartChangeset().Remove(cnameRrset).Apply()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue