Skip to content

Commit

Permalink
Return error if db not found
Browse files Browse the repository at this point in the history
Signed-off-by: hmsayem <[email protected]>
  • Loading branch information
hmsayem committed Aug 11, 2023
1 parent 13fc9fd commit 8ee7993
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package pkg

import (
"context"
"fmt"
"path/filepath"

api_v1beta1 "stash.appscode.dev/apimachinery/apis/stash/v1beta1"
Expand Down Expand Up @@ -223,6 +224,11 @@ func (opt *mysqlOptions) backupMySQL(targetRef api_v1beta1.TargetRef) (*restic.B
if err != nil {
return nil, err
}

if len(databases) == 0 {
return nil, fmt.Errorf("unable to find any databases for backup")
}

session.setTargetDatabases(databases)

session.setUserArgs(opt.myArgs)
Expand Down

0 comments on commit 8ee7993

Please sign in to comment.