fix: ensure PBS backup monitoring is enabled for all PBS instances (addresses #411)

- Added migration to automatically enable MonitorBackups for PBS instances
- This fixes the issue where PBS backups weren't showing for some users
- The migration runs on startup and persists the changes
- All new PBS instances already have MonitorBackups enabled by default
This commit is contained in:
Pulse Monitor
2025-09-04 12:56:38 +00:00
parent 761c7b144f
commit de0b7d8012
+24
View File
@@ -505,6 +505,9 @@ func (c *ConfigPersistence) LoadNodesConfig() (*NodesConfig, error) {
return nil, err
}
// Track if any migrations were applied
migrationApplied := false
// Fix for bug where TokenName was incorrectly set when using password auth
// If a PBS instance has both Password and TokenName, clear the TokenName
for i := range config.PBSInstances {
@@ -558,6 +561,27 @@ func (c *ConfigPersistence) LoadNodesConfig() (*NodesConfig, error) {
}
}
}
// Migration: Ensure MonitorBackups is enabled for PBS instances
// This fixes issue #411 where PBS backups weren't showing
if !config.PBSInstances[i].MonitorBackups {
log.Info().
Str("instance", config.PBSInstances[i].Name).
Msg("Enabling MonitorBackups for PBS instance (was disabled)")
config.PBSInstances[i].MonitorBackups = true
migrationApplied = true
}
}
// If any migrations were applied, save the updated configuration
if migrationApplied {
log.Info().Msg("Migrations applied, saving updated configuration")
// Need to unlock before saving to avoid deadlock
c.mu.RUnlock()
if err := c.SaveNodesConfig(config.PVEInstances, config.PBSInstances); err != nil {
log.Error().Err(err).Msg("Failed to save configuration after migration")
}
c.mu.RLock()
}
log.Info().Str("file", c.nodesFile).