backend.Records make it take request.Request (#943)

This is more general and aligns well with the other methods.
Also allows the kubernetes middleware to use it.

Fixes #940
This commit is contained in:
Miek Gieben 2017-08-19 14:03:03 +01:00 committed by GitHub
parent 627687b11f
commit 7c343982a6
4 changed files with 14 additions and 12 deletions

View file

@ -9,6 +9,7 @@ import (
"github.com/coredns/coredns/middleware/etcd/msg"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
)
@ -29,7 +30,11 @@ func (e *Etcd) UpdateStubZones() {
// Only the first zone configured on e is used for the lookup.
func (e *Etcd) updateStubZones() {
zone := e.Zones[0]
services, err := e.Records(stubDomain+"."+zone, false)
fakeState := request.Request{W: nil, Req: new(dns.Msg)}
fakeState.Req.SetQuestion(stubDomain+"."+zone, dns.TypeA)
services, err := e.Records(fakeState, false)
if err != nil {
return
}