mirror of https://github.com/hashicorp/consul
DNS: fix agent returning SERVFAIL where NXDOMAIN should be returned
parent
3b4ddaaab5
commit
8d18422f19
|
@ -829,7 +829,7 @@ func (d *DNSServer) computeRCode(err error) int {
|
|||
return dns.RcodeSuccess
|
||||
}
|
||||
dErr := err.Error()
|
||||
if dErr == structs.ErrNoDCPath.Error() || dErr == consul.ErrQueryNotFound.Error() {
|
||||
if structs.IsErrNoDCPath(err) || dErr == consul.ErrQueryNotFound.Error() {
|
||||
return dns.RcodeNameError
|
||||
}
|
||||
return dns.RcodeServerFailure
|
||||
|
|
|
@ -26,6 +26,10 @@ var (
|
|||
ErrDCNotAvailable = errors.New(errDCNotAvailable)
|
||||
)
|
||||
|
||||
func IsErrNoDCPath(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), errNoDCPath)
|
||||
}
|
||||
|
||||
func IsErrNoLeader(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), errNoLeader)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue