Skip to content

Commit

Permalink
Group alias records by target type. Fixes #195.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnybug committed Sep 10, 2016
1 parent a6b80cb commit 55ad8ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ func groupRecords(records []dns.RR) map[Key][]dns.RR {
if aws, ok := record.(*AWSRR); ok {
identifier = aws.Identifier
}
if alias, ok := record.(*dns.PrivateRR); ok {
// issue #195: alias records need to be keyed by the type of the alias too
rdata := alias.Data.(*ALIASRdata)
identifier += "@" + rdata.Type
}
key := Key{record.Header().Name, record.Header().Rrtype, identifier}
grouped[key] = append(grouped[key], record)
}
Expand Down
5 changes: 5 additions & 0 deletions internal/features/import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Feature: import
When I run "cli53 import --file tests/alias.txt $domain"
Then the domain "$domain" export matches file "tests/alias.txt"

Scenario: I can import a zone with an alias with multiple types
Given I have a domain "$domain"
When I run "cli53 import --file tests/alias_multiple_types.txt $domain"
Then the domain "$domain" export matches file "tests/alias_multiple_types.txt"

Scenario: I can import (replace) a zone
Given I have a domain "$domain"
When I run "cli53 import --file tests/replace1.txt $domain"
Expand Down
4 changes: 4 additions & 0 deletions tests/alias_multiple_types.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
www 86400 IN A 127.0.0.1
www 86400 IN AAAA ::1
alias 86400 AWS ALIAS A www $self false
alias 86400 AWS ALIAS AAAA www $self false

0 comments on commit 55ad8ed

Please sign in to comment.