Allow an empty password when adding a new MySQL user. (#3445)
This commit is contained in:
parent
2b003a2773
commit
766671f1e1
1 changed files with 6 additions and 6 deletions
|
@ -32,7 +32,7 @@ options:
|
|||
required: true
|
||||
password:
|
||||
description:
|
||||
- set the user's password. (Required when adding a user)
|
||||
- set the user's password.
|
||||
required: false
|
||||
default: null
|
||||
encrypted:
|
||||
|
@ -232,6 +232,8 @@ def user_add(cursor, user, host, host_all, password, encrypted, new_priv, check_
|
|||
cursor.execute("CREATE USER %s@%s IDENTIFIED BY PASSWORD %s", (user,host,password))
|
||||
elif password and not encrypted:
|
||||
cursor.execute("CREATE USER %s@%s IDENTIFIED BY %s", (user,host,password))
|
||||
else:
|
||||
cursor.execute("CREATE USER %s@%s", (user,host))
|
||||
|
||||
if new_priv is not None:
|
||||
for db_table, priv in new_priv.iteritems():
|
||||
|
@ -559,8 +561,6 @@ def main():
|
|||
except (SQLParseError, InvalidPrivsError, MySQLdb.Error), e:
|
||||
module.fail_json(msg=str(e))
|
||||
else:
|
||||
if password is None:
|
||||
module.fail_json(msg="password parameter required when adding a user")
|
||||
if host_all:
|
||||
module.fail_json(msg="host_all parameter cannot be used when adding a user")
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue