fix: make instance ID required field

This commit is contained in:
garethgeorge
2024-07-01 21:05:50 -07:00
parent 90e0656fc4
commit 7c8ded2fcc
5 changed files with 42 additions and 59 deletions

View File

@@ -15,8 +15,9 @@ import (
var NeverScheduledTask = ScheduledTask{}
const (
PlanForUnassociatedOperations = "_unassociated_"
PlanForSystemTasks = "_system_" // plan for system tasks e.g. garbage collection, prune, stats, etc.
PlanForUnassociatedOperations = "_unassociated_"
InstanceIDForUnassociatedOperations = "_unassociated_"
PlanForSystemTasks = "_system_" // plan for system tasks e.g. garbage collection, prune, stats, etc.
TaskPriorityStats = 0
TaskPriorityDefault = 1 << 1 // default priority

View File

@@ -191,7 +191,11 @@ func planForSnapshot(snapshot *v1.ResticSnapshot) string {
}
func instanceIDForSnapshot(snapshot *v1.ResticSnapshot) string {
return repo.InstanceIDFromTags(snapshot.Tags)
id := repo.InstanceIDFromTags(snapshot.Tags)
if id != "" {
return id
}
return InstanceIDForUnassociatedOperations
}
// tryMigrate checks if the snapshots use the latest backrest tag set and migrates them if necessary.