Skip to content

Commit

Permalink
skip error when database already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Oct 20, 2022
1 parent dae3cb7 commit 36585e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ func (ps *ProvisionerServer) DriverCreateDatabase(_ context.Context, req *databa
databaseName := req.GetName()
klog.Info("Create Database", "name", databaseName)
if err := ps.postgresDB.CreateDatabase(databaseName); err != nil {
klog.Errorf("Failed to create database %v", err)
return &databasespec.DriverCreateDatabaseResponse{}, err
if status.Code(err) != codes.AlreadyExists {
klog.Errorf("Failed to create database %v", err)
return &databasespec.DriverCreateDatabaseResponse{}, err
}
}

return &databasespec.DriverCreateDatabaseResponse{
Expand Down

0 comments on commit 36585e8

Please sign in to comment.