mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-13 02:09:08 +02:00
[client] Address the remaining bot findings on PR #7398
- Login logged the active-profile-state error and returned the same cause; the repo's guidelines call for one or the other, and the wrapped error is the one that carries context. (CodeRabbit) - `netbird up` reported a codes.Unavailable SetConfig failure as "the daemon refused the settings update", but that code also covers a daemon that became unreachable. It now reports what the daemon said without asserting why. (cubic-dev-ai) - TestLogin_ChangingTheManagementURLIsRefused asserted the error and nothing else, while "refused before it can touch daemon state" is the contract. It now checks the stored management URL, the in-progress login and the active profile, matching its SetConfig counterpart. (cubic-dev-ai)
This commit is contained in:
+5
-4
@@ -353,10 +353,11 @@ func runInDaemonMode(ctx context.Context, cmd *cobra.Command, pm *profilemanager
|
||||
req := setupSetConfigReq(customDNSAddressConverted, cmd, activeProf.ID.String(), username.Username)
|
||||
if _, err := client.SetConfig(ctx, req); err != nil {
|
||||
if st, ok := gstatus.FromError(err); ok && st.Code() == codes.Unavailable {
|
||||
// The daemon refused the settings update, it did not lack the
|
||||
// method: reporting the latter sent people looking for a version
|
||||
// mismatch that was not there.
|
||||
log.Warnf("the daemon refused the settings update: %s", st.Message())
|
||||
// Report what the daemon said rather than asserting why: this code
|
||||
// covers both a refused update and a daemon that became
|
||||
// unreachable. Claiming the method was missing, as this used to,
|
||||
// sent people looking for a version mismatch that was not there.
|
||||
log.Warnf("the daemon did not apply the settings update: %s", st.Message())
|
||||
} else {
|
||||
return daemonCallError("call service setConfig method", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user