diff options
Diffstat (limited to 'lib/modules/mysql_user2')
-rw-r--r-- | lib/modules/mysql_user2 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/modules/mysql_user2 b/lib/modules/mysql_user2 index f2d9d40..20742fe 100644 --- a/lib/modules/mysql_user2 +++ b/lib/modules/mysql_user2 @@ -1,21 +1,21 @@ -#!/usr/bin/python +#!/usr/bin/python3 # (c) 2012, Mark Theunissen <mark.theunissen@gmail.com> # Sponsored by Four Kitchens http://fourkitchens.com. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. DOCUMENTATION = ''' @@ -455,40 +455,40 @@ def main(): mycnf_creds = load_mycnf() if mycnf_creds is False: login_user = "root" login_password = "" else: login_user = mycnf_creds["user"] login_password = mycnf_creds["passwd"] elif login_password is None or login_user is None: module.fail_json(msg="when supplying login arguments, both login_user and login_password must be provided") cursor = None try: if check_implicit_admin: try: cursor = connect(module, 'root', '') except: pass if not cursor: cursor = connect(module, login_user, login_password) - except Exception, e: + except Exception as e: module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials") if state == "present": if user_exists(cursor, user, host): changed = user_mod(cursor, user, host, password, priv, append_privs, auth_plugin) else: if (password is None and auth_plugin is None) or (password is not None and auth_plugin is not None): module.fail_json(msg="password xor auth_plugin is required when adding a user") changed = user_add(cursor, user, host, password, priv, auth_plugin, soname) elif state == "absent": if user_exists(cursor, user, host): changed = user_delete(cursor, user, host) else: changed = False module.exit_json(changed=changed, user=user) # this is magic, see lib/ansible/module_common.py #<<INCLUDE_ANSIBLE_MODULE_COMMON>> main() |