@@ -236,6 +236,17 @@ func runSnapshot(cmd *cobra.Command, args []string) error {
236236 }
237237
238238 for _ , group := range snapshotGroups {
239+ if state , ok , err := utils .CheckSnapshotStateInRepo (client , cfg .SnapshotRepo , group .SnapshotName ); err == nil && ok {
240+ if state == "SUCCESS" {
241+ logger .Info (fmt .Sprintf ("Valid snapshot already exists snapshot=%s" , group .SnapshotName ))
242+ continue
243+ }
244+ if state == "IN_PROGRESS" {
245+ logger .Info (fmt .Sprintf ("Snapshot is currently IN_PROGRESS snapshot=%s repo=%s" , group .SnapshotName , cfg .SnapshotRepo ))
246+ continue
247+ }
248+ }
249+
239250 exists , err := utils .CheckAndCleanSnapshot (group .SnapshotName , strings .Join (group .Indices , "," ), allSnapshots , client , cfg .SnapshotRepo , logger )
240251 if err != nil {
241252 logger .Error (fmt .Sprintf ("Failed to check/clean snapshot snapshot=%s error=%v" , group .SnapshotName , err ))
@@ -271,6 +282,16 @@ func runSnapshot(cmd *cobra.Command, args []string) error {
271282 continue
272283 }
273284 for _ , g := range groups {
285+ if state , ok , err := utils .CheckSnapshotStateInRepo (client , repo , g .SnapshotName ); err == nil && ok {
286+ if state == "SUCCESS" {
287+ logger .Info (fmt .Sprintf ("Valid snapshot already exists repo=%s snapshot=%s" , repo , g .SnapshotName ))
288+ continue
289+ }
290+ if state == "IN_PROGRESS" {
291+ logger .Info (fmt .Sprintf ("Snapshot is currently IN_PROGRESS repo=%s snapshot=%s" , repo , g .SnapshotName ))
292+ continue
293+ }
294+ }
274295 exists , err := utils .CheckAndCleanSnapshot (g .SnapshotName , strings .Join (g .Indices , "," ), existing , client , repo , logger )
275296 if err != nil {
276297 logger .Error (fmt .Sprintf ("Failed to check/clean snapshot repo=%s snapshot=%s error=%v" , repo , g .SnapshotName , err ))
0 commit comments