Revert change of order of checks when setting up resource DB (#105514)

* Revert change of order in newResourceDBProvider

* Ignore error in provisioningSecrets when working with wrong DB.

* Update workspace.

* Add owner.
This commit is contained in:
Peter Štibraný
2025-05-16 11:35:36 +03:00
committed by GitHub
parent 8dda9da035
commit 1ffe653156
2 changed files with 6 additions and 5 deletions
@@ -49,7 +49,8 @@ func (p provisioningSecrets) reEncrypt(
Find(&rows)
}); err != nil {
logger.Warn("Could not find any provisioning secrets to re-encrypt", "error", err, "action", action)
return false
// resource table may not exists (when not using unified storage and right db), so we don't report error here.
return true
}
var failures int
+4 -4
View File
@@ -104,6 +104,10 @@ func newResourceDBProvider(grafanaDB infraDB.DB, cfg *setting.Cfg, tracer trace.
return p, fmt.Errorf("invalid db type specified: %s", dbType)
// If we have an empty Resource API db config, try with the core Grafana database config
case grafanaDBType != "":
p.registerMetrics = true
p.engine, err = getEngine(cfg)
return p, err
case grafanaDB != nil:
// try to use the grafana db connection (should only happen in tests)
if fallbackGetter.Bool(grafanaDBInstrumentQueriesKey) {
@@ -111,10 +115,6 @@ func newResourceDBProvider(grafanaDB infraDB.DB, cfg *setting.Cfg, tracer trace.
}
p.engine = grafanaDB.GetEngine()
return p, nil
case grafanaDBType != "":
p.registerMetrics = true
p.engine, err = getEngine(cfg)
return p, err
default:
return p, fmt.Errorf("no database type specified")
}