Merge pull request #20810 from Luap99/sqlite-validate

sqlite: fix issue in ValidateDBConfig()
This commit is contained in:
openshift-merge-bot[bot]
2023-11-28 16:04:42 +00:00
committed by GitHub

View File

@ -373,10 +373,6 @@ func (s *SQLiteState) ValidateDBConfig(runtime *Runtime) (defErr error) {
return fmt.Errorf("retrieving DB config: %w", err)
}
if err := tx.Commit(); err != nil {
return fmt.Errorf("committing database validation row: %w", err)
}
checkField := func(fieldName, dbVal, ourVal string) error {
if dbVal != ourVal {
return fmt.Errorf("database %s %q does not match our %s %q: %w", fieldName, dbVal, fieldName, ourVal, define.ErrDBBadConfig)
@ -407,6 +403,12 @@ func (s *SQLiteState) ValidateDBConfig(runtime *Runtime) (defErr error) {
return err
}
if err := tx.Commit(); err != nil {
return fmt.Errorf("committing database validation row: %w", err)
}
// Do not return any error after the commit call because the defer will
// try to roll back the transaction which results in an logged error.
return nil
}