Skip to content

Commit 9c5da74

Browse files
Fix bug of dropping the user when GrantOn changes
1 parent 15f1d91 commit 9c5da74

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/mysql_user_provider.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ def mysql_user_host(self, user):
253253
@property
254254
def url(self):
255255
if self.with_database:
256-
return 'mysql:%s:%s:%s:%s:%s:%s' % (self.host, self.port, self.dbname, self.mysql_user(self.user), self.user, self.grant_on)
256+
return 'mysql:%s:%s:%s:%s:%s' % (self.host, self.port, self.dbname, self.mysql_user(self.user), self.user)
257257
else:
258-
return 'mysql:%s:%s:%s::%s:%s' % (self.host, self.port, self.dbname, self.user, self.grant_on)
258+
return 'mysql:%s:%s:%s::%s' % (self.host, self.port, self.dbname, self.user)
259259

260260
def connect(self):
261261
log.info('connecting to database %s on port %d as user %s', self.host, self.port, self.dbowner)
@@ -434,9 +434,10 @@ def create(self):
434434

435435
def update(self):
436436
if (self.dbname != self.dbname_old or
437-
self.user != self.user_old or
438-
self.grant_on != self.grant_on_old):
437+
self.user != self.user_old):
439438
# Major change, recreate..
439+
# Triggers a DELETE of the old resource
440+
# after creation of the new is complete
440441
return self.create()
441442

442443
if (self.grant_on == self.grant_on_old and

0 commit comments

Comments
 (0)