From 2c35cfce9a9412b288af136bd75a8c6f7491332b Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Mon, 3 Aug 2015 10:49:37 +0000 Subject: [PATCH] Revert "escapeds changes" While this change doesn't break the creation, it does break idempotency. This change will convert '*.*' to '`*`.*' which is functionally the same, however when the user_mod() function looks up the current privileges with privileges_get() it will read '*.*' Since '*.*' != '`*`.*' it will go through the process of updating the privleges always resulting in a 'changed' result. This reverts commit db9ab9b2629f00350a743a4eca72fb5ee8dc8c77. --- database/mysql/mysql_user.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/database/mysql/mysql_user.py b/database/mysql/mysql_user.py index 7c72546706a..4f0dee5374c 100644 --- a/database/mysql/mysql_user.py +++ b/database/mysql/mysql_user.py @@ -320,8 +320,13 @@ def privileges_unpack(priv): privs = [] for item in priv.strip().split('/'): pieces = item.strip().split(':') - dbpriv = pieces[0].rsplit(".", 1) - pieces[0] = "`%s`.%s" % (dbpriv[0].strip('`'), dbpriv[1]) + if '.' in pieces[0]: + pieces[0] = pieces[0].split('.') + for idx, piece in enumerate(pieces): + if pieces[0][idx] != "*": + pieces[0][idx] = "`" + pieces[0][idx] + "`" + pieces[0] = '.'.join(pieces[0]) + if '(' in pieces[1]: output[pieces[0]] = re.split(r',\s*(?=[^)]*(?:\(|$))', pieces[1].upper()) for i in output[pieces[0]]: