summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2014-12-01 07:15:27 -0800
committerJames Cammarata <jimi@sngx.net>2014-12-04 15:46:15 -0600
commit55e4c32034b1ec06fba5277cb89e06a71e9b8dbe (patch)
tree706ee502c50a3eeb7b0b62c298f08533c252c69f
parentdd4095137a00b1ddec1de5fe21495a28be0b9f03 (diff)
downloadansible-modules-core-55e4c32034b1ec06fba5277cb89e06a71e9b8dbe.tar.gz
Fix module traceback instead of returning an error
-rw-r--r--database/mysql/mysql_user.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/database/mysql/mysql_user.py b/database/mysql/mysql_user.py
index 9bb1d7be..e8461a05 100644
--- a/database/mysql/mysql_user.py
+++ b/database/mysql/mysql_user.py
@@ -256,7 +256,7 @@ def privileges_get(cursor, user,host):
for grant in grants:
res = re.match("GRANT (.+) ON (.+) TO '.+'@'.+'( IDENTIFIED BY PASSWORD '.+')? ?(.*)", grant[0])
if res is None:
- module.fail_json(msg="unable to parse the MySQL grant string")
+ raise InvalidPrivsError('unable to parse the MySQL grant string: %s' % grant[0])
privileges = res.group(1).split(", ")
privileges = [ pick(x) for x in privileges]
if "WITH GRANT OPTION" in res.group(4):
@@ -485,6 +485,8 @@ def main():
changed = user_mod(cursor, user, host, password, priv, append_privs)
except SQLParseError, e:
module.fail_json(msg=str(e))
+ except InvalidPrivsError, e:
+ module.mail_json(msg=str(e))
else:
if password is None:
module.fail_json(msg="password parameter required when adding a user")