[WIP] Add zone-level checker between domain-level and service-level
This commit is contained in:
parent
cb3ce4b4dc
commit
1eb8249396
2 changed files with 13 additions and 0 deletions
|
|
@ -238,6 +238,14 @@ func (tu *checkerUsecase) buildAutoFillContext(userid *happydns.Identifier, doma
|
|||
if domainid != nil {
|
||||
if domain, err := tu.autoFillStore.GetDomain(*domainid); err == nil {
|
||||
ctx[happydns.AutoFillDomainName] = domain.DomainName
|
||||
|
||||
if len(domain.ZoneHistory) > 0 {
|
||||
// The first element in ZoneHistory is the current (most recent) zone.
|
||||
zoneMsg, err := tu.autoFillStore.GetZone(domain.ZoneHistory[0])
|
||||
if err == nil {
|
||||
ctx[happydns.AutoFillZone] = zoneMsg
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if serviceid != nil && userid != nil {
|
||||
// To resolve service context we need to find which domain/zone owns the service.
|
||||
|
|
@ -263,6 +271,7 @@ func (tu *checkerUsecase) buildAutoFillContext(userid *happydns.Identifier, doma
|
|||
if svc.Id.Equals(*serviceid) {
|
||||
ctx[happydns.AutoFillDomainName] = domain.DomainName
|
||||
ctx[happydns.AutoFillSubdomain] = string(subdomain)
|
||||
ctx[happydns.AutoFillZone] = zoneMsg
|
||||
ctx[happydns.AutoFillService] = svc
|
||||
ctx[happydns.AutoFillServiceType] = svc.Type
|
||||
return ctx
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ const (
|
|||
// applicable for service-scoped tests.
|
||||
AutoFillSubdomain = "subdomain"
|
||||
|
||||
// AutoFillZone fills the option with the zone object. Only applicable
|
||||
// for domain-scoped and service-scoped tests.
|
||||
AutoFillZone = "zone"
|
||||
|
||||
// AutoFillServiceType fills the option with the service type identifier
|
||||
// (e.g. "abstract.MatrixIM"). Only applicable for service-scoped tests.
|
||||
AutoFillServiceType = "service_type"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue