Refix bug 1226 after revert

This patch properly fixes bug 1226 without introducing a breaking
change to idempotency which was introduced in PR #1358

We can properly assign permissions to databases with a '.' in the name
of the database as well as assign priviliges to all databases as
specified with '*'
This commit is contained in:
Sam Yaple 2015-08-19 04:22:31 +00:00
parent 5913f5e5e1
commit dddb5270c8

View file

@ -320,6 +320,11 @@ def privileges_unpack(priv):
privs = [] privs = []
for item in priv.strip().split('/'): for item in priv.strip().split('/'):
pieces = item.strip().split(':') pieces = item.strip().split(':')
dbpriv = pieces[0].rsplit(".", 1)
# Do not escape if privilege is for database '*' (all databases)
if dbpriv[0].strip('`') != '*':
pieces[0] = "`%s`.%s" % (dbpriv[0].strip('`'), dbpriv[1])
if '.' in pieces[0]: if '.' in pieces[0]:
pieces[0] = pieces[0].split('.') pieces[0] = pieces[0].split('.')
for idx, piece in enumerate(pieces): for idx, piece in enumerate(pieces):