Skip to content

Commit

Permalink
Pull request: 4846-migration-fix
Browse files Browse the repository at this point in the history
Updates #4846.

Squashed commit of the following:

commit 22e2e89
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Aug 18 16:25:07 2022 +0300

    home: fix yaml object type
  • Loading branch information
ainar-g committed Aug 18, 2022
1 parent 257d167 commit 4a7b4d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ and this project adheres to

- Go 1.18 support. v0.109.0 will require at least Go 1.19 to build.

### Fixed

- Migrations from releases older than v0.107.7 failing ([#4846]).

[#2993]: https://github.com/AdguardTeam/AdGuardHome/issues/2993
[#4795]: https://github.com/AdguardTeam/AdGuardHome/issues/4795
[#4846]: https://github.com/AdguardTeam/AdGuardHome/issues/4846



Expand Down
6 changes: 3 additions & 3 deletions internal/home/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const currentSchemaVersion = 14
// These aliases are provided for convenience.
type (
yarr = []any
yobj = map[any]any
yobj = map[string]any
)

// Performs necessary upgrade operations if needed
Expand Down Expand Up @@ -182,12 +182,12 @@ func upgradeSchema2to3(diskConf yobj) error {
newDNSConfig := make(yobj)

switch v := dnsConfig.(type) {
case map[any]any:
case yobj:
for k, v := range v {
newDNSConfig[fmt.Sprint(k)] = v
}
default:
return fmt.Errorf("dns configuration is not a map")
return fmt.Errorf("unexpected type of dns: %T", dnsConfig)
}

// Replace bootstrap_dns value filed with new array contains old bootstrap_dns inside
Expand Down

0 comments on commit 4a7b4d0

Please sign in to comment.