Skip to content

Commit

Permalink
fix: don't add the storage name twice to the scheduled backup name
Browse files Browse the repository at this point in the history
Don't add the storage name twice to the scheduled backup name

Adding a storage name twice might make a job name longer than 63 characters
and break backup creation
  • Loading branch information
s10 committed Dec 23, 2024
1 parent 65f7f15 commit eca32da
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/naming/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@ func trimJobName(name string) string {
}

func ScheduledBackupName(crName, storageName, schedule string) string {
result := "cron-"
result := "cron"

if len(crName) > 16 {
result += crName[:16]
result += "-" + crName[:16]
} else {
result += crName
result += "-" + crName
}

if len(storageName) > 16 {
result += storageName[:16]
result += "-" + storageName[:16]
} else {
result += storageName
result += "-" + storageName
}

result += "-" + storageName + "-"
tnow := time.Now()
result += fmt.Sprintf("%d%d%d%d%d%d", tnow.Year(), tnow.Month(), tnow.Day(), tnow.Hour(), tnow.Minute(), tnow.Second())
result += "-" + strconv.FormatUint(uint64(crc32.ChecksumIEEE([]byte(schedule))), 32)[:5]
Expand Down

0 comments on commit eca32da

Please sign in to comment.