Skip to content

Commit fd20c05

Browse files
committed
refactor: update audit log calls to ignore errors
1 parent 3ed08ec commit fd20c05

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

client/bun/client.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,7 @@ func (c *BunClient) UpdateAccount(ctx context.Context, id client.AccountId, user
470470
return client.Account{}, fmt.Errorf("failed to update hostname: %w", err)
471471
}
472472
}
473-
if m.Username != username {
474-
// Note: Store doesn't have UpdateAccountUsername; skip for now or add if needed.
475-
// For this phase, we only update hostname via UpdateAccountHostname.
476-
}
473+
// Username is not persisted through this store path yet.
477474

478475
return client.Account{
479476
Id: client.AccountId(m.ID),

client/testui/client.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (c *Client) CreatePublicKey(ctx context.Context, key string, comment string
130130
publicKey := client.PublicKey{Id: c.publicKeyIdCounter, Algorithm: algorithm, Data: data, Comment: comment, Tags: tags}
131131
c.publicKeys[publicKey.Id] = publicKey
132132

133-
c.writeAuditLog("public_key.create", fmt.Sprintf("%#v", publicKey))
133+
_ = c.writeAuditLog("public_key.create", fmt.Sprintf("%#v", publicKey))
134134
return publicKey, nil
135135
}
136136

@@ -185,7 +185,7 @@ func (c *Client) UpdateLink(ctx context.Context, id client.LinkId, accountId cli
185185
link.ExpiresAt = expiresAt
186186
c.links[id] = link
187187

188-
c.writeAuditLog("link.update", fmt.Sprintf("%#v", link))
188+
_ = c.writeAuditLog("link.update", fmt.Sprintf("%#v", link))
189189
return link, nil
190190
}
191191
return client.Link{}, fmt.Errorf("account with id %v not found", id)
@@ -197,7 +197,7 @@ func (c *Client) UpdatePublicKey(ctx context.Context, id client.PublicKeyId, com
197197
publicKey.Tags = tags
198198
c.publicKeys[id] = publicKey
199199

200-
c.writeAuditLog("public_key.update", fmt.Sprintf("%#v", publicKey))
200+
_ = c.writeAuditLog("public_key.update", fmt.Sprintf("%#v", publicKey))
201201
return publicKey, nil
202202
}
203203
return client.PublicKey{}, fmt.Errorf("public key with id %v not found", id)
@@ -212,7 +212,7 @@ func (c *Client) DeletePublicKeys(ctx context.Context, ids ...client.PublicKeyId
212212

213213
for _, id := range ids {
214214
delete(c.publicKeys, id)
215-
c.writeAuditLog("public_key.delete", fmt.Sprintf("%#v", id))
215+
_ = c.writeAuditLog("public_key.delete", fmt.Sprintf("%#v", id))
216216
}
217217

218218
return nil
@@ -225,7 +225,7 @@ func (c *Client) CreateAccount(ctx context.Context, username string, host string
225225
account := client.Account{Id: c.accountIdCounter, Username: username, Host: host, Port: port, DeployMethod: deploymentMethod, DeploySecret: deploymentSecret, DeployCache: ""}
226226
c.accounts[account.Id] = account
227227

228-
c.writeAuditLog("account.create", fmt.Sprintf("%#v", account))
228+
_ = c.writeAuditLog("account.create", fmt.Sprintf("%#v", account))
229229
return account, nil
230230
}
231231

@@ -273,7 +273,7 @@ func (c *Client) UpdateAccount(ctx context.Context, id client.AccountId, usernam
273273
account.DeploySecret = deploymentSecret
274274
c.accounts[id] = account
275275

276-
c.writeAuditLog("account.update", fmt.Sprintf("%#v", account))
276+
_ = c.writeAuditLog("account.update", fmt.Sprintf("%#v", account))
277277
return account, nil
278278
}
279279
return client.Account{}, fmt.Errorf("account with id %v not found", id)
@@ -288,7 +288,7 @@ func (c *Client) DeleteAccounts(ctx context.Context, ids ...client.AccountId) er
288288

289289
for _, id := range ids {
290290
delete(c.accounts, id)
291-
c.writeAuditLog("account.delete", fmt.Sprintf("%#v", id))
291+
_ = c.writeAuditLog("account.delete", fmt.Sprintf("%#v", id))
292292
}
293293

294294
return nil
@@ -310,7 +310,7 @@ func (c *Client) CreateLink(ctx context.Context, accountId client.AccountId, tag
310310
link := client.Link{Id: c.linkIdCounter, AccountId: accountId, TagMatcher: tagMatcher, ExpiresAt: expiresAt}
311311
c.links[link.Id] = link
312312

313-
c.writeAuditLog("link.create", fmt.Sprintf("%#v", link))
313+
_ = c.writeAuditLog("link.create", fmt.Sprintf("%#v", link))
314314
return link, nil
315315
}
316316

@@ -358,7 +358,7 @@ func (c *Client) DeleteLinks(ctx context.Context, ids ...client.LinkId) error {
358358

359359
for _, id := range ids {
360360
delete(c.links, id)
361-
c.writeAuditLog("link.delete", fmt.Sprintf("%#v", id))
361+
_ = c.writeAuditLog("link.delete", fmt.Sprintf("%#v", id))
362362
}
363363

364364
return nil
@@ -465,7 +465,7 @@ func (c *Client) DeployAccounts(ctx context.Context, accountIds ...client.Accoun
465465
// simulate deploying data to remote
466466
c.remoteStates[account.Id] = c.accountDeployCache(account, deployDatas[i])
467467

468-
c.writeAuditLog("account.deploy", fmt.Sprintf("%#v", account))
468+
_ = c.writeAuditLog("account.deploy", fmt.Sprintf("%#v", account))
469469

470470
// update accounts deploy cache
471471
_account := c.accounts[account.Id]
@@ -592,7 +592,7 @@ func (c *Client) VerifyAccounts(ctx context.Context, accountIds ...client.Accoun
592592
verifyProgress.Accounts[account.Id].Status = "finished"
593593
}
594594

595-
c.writeAuditLog("account.verify", fmt.Sprintf("%#v", account))
595+
_ = c.writeAuditLog("account.verify", fmt.Sprintf("%#v", account))
596596

597597
verifyProgress.Accounts[account.Id].Progress = 1
598598
verifyProgressChan <- verifyProgress

0 commit comments

Comments
 (0)