11package cmd
22
33import (
4- "context"
5-
64 "github.com/rs/zerolog/log"
75 "github.com/spf13/cobra"
86
@@ -25,8 +23,7 @@ var cleanupCmd = &cobra.Command{
2523 Long : `Clean up old backups based on the configured retention policy.
2624This command will remove backups that exceed the retention limits defined
2725in the configuration file (retention_days and/or retention_count).` ,
28- Run : func (_ * cobra.Command , _ []string ) {
29- ctx := context .Background ()
26+ Run : func (cmd * cobra.Command , _ []string ) {
3027 logger := log .Logger .With ().Str ("caller" , "retention_cleanup_cmd" ).Logger ()
3128
3229 // Count configured storage backends
@@ -50,7 +47,7 @@ in the configuration file (retention_days and/or retention_count).`,
5047
5148 // Run S3 retention cleanup if configured
5249 if config .Loaded .Storage .S3 != nil {
53- if err := s3 .CleanupRetention (ctx ); err != nil {
50+ if err := s3 .CleanupRetention (cmd . Context () ); err != nil {
5451 logger .Error ().Err (err ).
5552 Str ("bucket" , config .Loaded .Storage .S3 .Bucket ).
5653 Msg ("S3 retention cleanup failed" )
@@ -64,7 +61,7 @@ in the configuration file (retention_days and/or retention_count).`,
6461
6562 // Run local retention cleanup if configured
6663 if config .Loaded .Storage .Local != nil {
67- if err := local .CleanupRetention (ctx ); err != nil {
64+ if err := local .CleanupRetention (cmd . Context () ); err != nil {
6865 logger .Error ().Err (err ).
6966 Str ("directory" , config .Loaded .Storage .Local .Directory ).
7067 Msg ("local retention cleanup failed" )
0 commit comments