From 1fe608afbf29807800cf3db6cac7b838ef0bf6b9 Mon Sep 17 00:00:00 2001 From: dramaley Date: Thu, 29 Jun 2017 09:32:36 -0500 Subject: [PATCH] Fix for database names that contain colons Bug fix: Permissions were not parsed correctly if the database name contains a colon (:) character. For example, a privilege string of "*.*:USAGE/`lnx-www-prod:wordpress`.*:ALL" would fail with "invalid privileges string: Invalid privileges specified: frozenset(['WORDPRESS`.*'])". This 1-line fix works around the problem. --- lib/ansible/modules/database/mysql/mysql_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index 9ac731af680..f04f876d63c 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -478,7 +478,7 @@ def privileges_unpack(priv, mode): output = {} privs = [] for item in priv.strip().split('/'): - pieces = item.strip().split(':') + pieces = item.strip().rsplit(':', 1) dbpriv = pieces[0].rsplit(".", 1) # Do not escape if privilege is for database or table, i.e. # neither quote *. nor .*