Skip to content

Commit 3d6b6a0

Browse files
committed
feat: mark account as dirty on hash mismatch and log errors
1 parent 6600ff6 commit 3d6b6a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/core/facades.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ func AuditAccounts(ctx context.Context, st Store, dm DeployerManager, mode strin
137137
if aw := DefaultAuditWriter(); aw != nil {
138138
_ = aw.LogAction("AUDIT_HASH_MISMATCH", fmt.Sprintf("account:%d stored:%s computed:%s", acc.ID, expectedHash, remoteHash))
139139
}
140+
// Mark the account dirty so other systems know the host state changed.
141+
if err := st.UpdateAccountIsDirty(acc.ID, true); err != nil {
142+
if aw := DefaultAuditWriter(); aw != nil {
143+
_ = aw.LogAction("AUDIT_HASH_MARK_DIRTY_FAILED", fmt.Sprintf("account:%d err:%v", acc.ID, err))
144+
}
145+
}
140146
}
141147
default:
142148
return nil, fmt.Errorf("invalid audit mode: %s", mode)

0 commit comments

Comments
 (0)