[#114] nns: Move deleting global aliases along with TXT records
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
9632ef8970
commit
820bd283c1
1 changed files with 10 additions and 13 deletions
|
@ -509,12 +509,16 @@ func deleteRecords(ctx storage.Context, name string, typ RecordType) {
|
||||||
tokenID := []byte(tokenIDFromName(name))
|
tokenID := []byte(tokenIDFromName(name))
|
||||||
ns := getNameState(ctx, tokenID)
|
ns := getNameState(ctx, tokenID)
|
||||||
ns.checkAdmin()
|
ns.checkAdmin()
|
||||||
|
if typ == TXT {
|
||||||
globalDomainStorage := append([]byte{prefixGlobalDomain}, getTokenKey([]byte(name))...)
|
globalDomainKey := append([]byte{prefixGlobalDomain}, getTokenKey([]byte(name))...)
|
||||||
globalDomainRaw := storage.Get(ctx, globalDomainStorage)
|
globalDomainRaw := storage.Get(ctx, globalDomainKey)
|
||||||
globalDomain := globalDomainRaw.(string)
|
if globalDomainRaw != nil {
|
||||||
if globalDomainRaw != nil && globalDomain != "" {
|
globalDomain := globalDomainRaw.(string)
|
||||||
deleteDomain(ctx, globalDomain)
|
if globalDomain != "" {
|
||||||
|
deleteDomain(ctx, globalDomain)
|
||||||
|
}
|
||||||
|
storage.Delete(ctx, globalDomainKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recordsKey := getRecordsKeyByType(tokenID, name, typ)
|
recordsKey := getRecordsKeyByType(tokenID, name, typ)
|
||||||
|
@ -550,13 +554,6 @@ func deleteDomain(ctx storage.Context, name string) {
|
||||||
ns := std.Deserialize(nsRaw.([]byte)).(NameState)
|
ns := std.Deserialize(nsRaw.([]byte)).(NameState)
|
||||||
ns.checkAdmin()
|
ns.checkAdmin()
|
||||||
|
|
||||||
globalNSKey := append([]byte{prefixGlobalDomain}, getTokenKey([]byte(name))...)
|
|
||||||
globalDomainRaw := storage.Get(ctx, globalNSKey)
|
|
||||||
globalDomain := globalDomainRaw.(string)
|
|
||||||
if globalDomainRaw != nil && globalDomain != "" {
|
|
||||||
deleteDomain(ctx, globalDomain)
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteRecords(ctx, name, CNAME)
|
deleteRecords(ctx, name, CNAME)
|
||||||
deleteRecords(ctx, name, TXT)
|
deleteRecords(ctx, name, TXT)
|
||||||
deleteRecords(ctx, name, A)
|
deleteRecords(ctx, name, A)
|
||||||
|
|
Loading…
Reference in a new issue