I broke the no-network edge case

This commit is contained in:
Joel Elkins 2024-03-30 23:33:37 -05:00
parent cffc259aeb
commit c2e55fb287
Signed by: joel
GPG Key ID: 133589DC38921AE2
1 changed files with 8 additions and 2 deletions

View File

@ -197,13 +197,19 @@ func (c *Container) doDnsForward(rr []string) error {
}
func (c *Container) NsUpdateCommands() cmd.Set {
if len(c.Networks) == 0 {
return c.newCommandSet("NSUPDATE", []cmd.Command{
cmd.NewNop(),
})
}
// check that a server is configured
if c.DomainName == "" || c.DnsServer == "" {
return cmd.Set{ID: "NSUPDATE", Commands: []cmd.Command{
return c.newCommandSet("NSUPDATE", []cmd.Command{
cmd.NewFunc("NSUPDATE_NOT_CONFIGURED", func() error {
return fmt.Errorf("nsupdate command requires `domain_name` and `dns_server` to be configured")
}),
}}
})
}
// determine hostname