Pull request: home: fix 8 to 9 migration

Updates #2988.

Squashed commit of the following:

commit 1b9f145be0dbcca9848e02942cea294315baa9cc
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 18:41:05 2021 +0300

    home: fix 8 to 9 migration
This commit is contained in:
Ainar Garipov
2021-04-20 18:56:15 +03:00
parent 93638a1936
commit 55cd4ae254
2 changed files with 52 additions and 17 deletions

View File

@@ -490,7 +490,16 @@ func upgradeSchema8to9(diskConf yobj) (err error) {
return fmt.Errorf("unexpected type of dns: %T", dnsVal)
}
autohostTLDVal := dns["autohost_tld"]
autohostTLDVal, ok := dns["autohost_tld"]
if !ok {
// This happens when upgrading directly from v0.105.2, because
// dns.autohost_tld was never set to any value. Go on and leave
// it that way.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2988.
return nil
}
autohostTLD, ok := autohostTLDVal.(string)
if !ok {
return fmt.Errorf("undexpected type of dns.autohost_tld: %T", autohostTLDVal)