Updated dir/bucket exists func
@@ -723,6 +723,10 @@ func (c *Client) processStartBackup(msg *pb.StartBackup) {
return
}
+ var sess *session.Session
+ var err error
+ switch msg.GetDestinationType() {
+ case pb.DestinationType_DESTINATION_TYPE_FILE:
fi, err := os.Stat(c.backupDir)
if err != nil {
c.sendDBBackupFinishError(errors.Wrapf(err, "Error while checking destination directory: %s", c.backupDir))
@@ -732,9 +736,7 @@ func (c *Client) processStartBackup(msg *pb.StartBackup) {
c.sendDBBackupFinishError(fmt.Errorf("%s is not a directory", c.backupDir))
return
}
-
- var sess *session.Session
- if msg.DestinationType == pb.DestinationType_DESTINATION_TYPE_AWS {
+ case pb.DestinationType_DESTINATION_TYPE_AWS:
sess, err = session.NewSession(&aws.Config{})
if err != nil {
msg := "Cannot create an AWS session for S3 backup"
