Fix for checking types of database on update

This commit is contained in:
Brian Kassouf 2017-03-28 10:04:42 -07:00
parent 494f963581
commit 02b0230f19
1 changed files with 3 additions and 1 deletions

View File

@ -279,6 +279,8 @@ func (b *databaseBackend) connectionWriteHandler(factory dbs.Factory) framework.
} }
if _, ok := b.connections[name]; ok { if _, ok := b.connections[name]; ok {
newType := db.Type()
// Don't update connection until the reset api is hit, close for // Don't update connection until the reset api is hit, close for
// now. // now.
err = db.Close() err = db.Close()
@ -287,7 +289,7 @@ func (b *databaseBackend) connectionWriteHandler(factory dbs.Factory) framework.
} }
// Don't allow the connection type to change // Don't allow the connection type to change
if b.connections[name].Type() != connType { if b.connections[name].Type() != newType {
return logical.ErrorResponse("Can not change type of existing connection."), nil return logical.ErrorResponse("Can not change type of existing connection."), nil
} }
} else { } else {