Skip to content

Commit

Permalink
Add check to ensure we don't overwrite existing connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Kassouf committed Apr 26, 2017
1 parent f92d686 commit 2e2d382
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion builtin/logical/database/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ func (b *databaseBackend) getDBObj(name string) (dbplugin.Database, bool) {
// caches it in the connections map. The caller of this function needs to hold
// the backend's write lock
func (b *databaseBackend) createDBObj(s logical.Storage, name string) (dbplugin.Database, error) {
db, ok := b.connections[name]
if ok {
return db, nil
}

config, err := b.DatabaseConfig(s, name)
if err != nil {
return nil, err
}

db, err := dbplugin.PluginFactory(config.PluginName, b.System(), b.logger)
db, err = dbplugin.PluginFactory(config.PluginName, b.System(), b.logger)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 2e2d382

Please sign in to comment.