Skip to content

Commit

Permalink
lxd: Fix lint errors (revive: unchecked-type-assertion).
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Laing <mark.laing@canonical.com>
  • Loading branch information
markylaing committed Feb 5, 2024
1 parent 3fd1a9f commit e692f99
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lxd/api_1.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func api10Put(d *Daemon, r *http.Request) response.Response {
logger.Debug("Handling config changed notification")
changed := make(map[string]string)
for key, value := range req.Config {
changed[key] = value.(string)
changed[key], _ = value.(string)
}

// Get the current (updated) config.
Expand Down Expand Up @@ -601,14 +601,15 @@ func doAPI10Update(d *Daemon, r *http.Request, req api.ServerPut, patch bool) re
return fmt.Errorf("Cannot fetch node config from database: %w", err)
}

newClusterHTTPSAddress, found := nodeValues["cluster.https_address"]
if !found && patch {
newClusterHTTPSAddress := ""
newClusterHTTPSAddressAny, found := nodeValues["cluster.https_address"]
if found {
newClusterHTTPSAddress, _ = newClusterHTTPSAddressAny.(string)
} else if patch {
newClusterHTTPSAddress = curConfig["cluster.https_address"]
} else if !found {
newClusterHTTPSAddress = ""
}

if curConfig["cluster.https_address"] != newClusterHTTPSAddress.(string) {
if curConfig["cluster.https_address"] != newClusterHTTPSAddress {
return fmt.Errorf("Changing cluster.https_address is currently not supported")
}
}
Expand Down

0 comments on commit e692f99

Please sign in to comment.