Add also-notify support for BIND domains.conf generation
Extend catz.yaml config with a bind-conf section mapping catalog names to also-notify IP lists. Zones in catalogs with also-notify configured get an also-notify directive in the generated domains.conf. IPs are deduplicated and sorted when a zone belongs to multiple catalogs.
This commit is contained in:
@@ -122,6 +122,36 @@ func TestValidateConfig(t *testing.T) {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("also-notify references unknown catalog", func(t *testing.T) {
|
||||
cfg := &Config{
|
||||
Catalogs: map[string]CatalogConfig{"cat1": {Zone: "cat.example.com."}},
|
||||
SOA: SOAConfig{Mname: "ns1.example.com.", Rname: "hostmaster.example.com."},
|
||||
BindConf: BindConfConfig{
|
||||
AlsoNotify: map[string][]string{
|
||||
"nonexistent": {"198.51.100.1"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := validateConfig(cfg); err == nil {
|
||||
t.Fatal("expected error for also-notify referencing unknown catalog")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("also-notify references valid catalog", func(t *testing.T) {
|
||||
cfg := &Config{
|
||||
Catalogs: map[string]CatalogConfig{"cat1": {Zone: "cat.example.com."}},
|
||||
SOA: SOAConfig{Mname: "ns1.example.com.", Rname: "hostmaster.example.com."},
|
||||
BindConf: BindConfConfig{
|
||||
AlsoNotify: map[string][]string{
|
||||
"cat1": {"198.51.100.1"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := validateConfig(cfg); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestLoadConfigWritePermission(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user