.
This commit is contained in:
29
salt/modules/_states/mysql.py
Normal file
29
salt/modules/_states/mysql.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import salt.exceptions
|
||||
|
||||
def root_password(name):
|
||||
"""
|
||||
Set the mysql/mariadb root password
|
||||
|
||||
password
|
||||
the password to user for root
|
||||
"""
|
||||
ret = {
|
||||
"name": "root password",
|
||||
"changes": {},
|
||||
"result": False,
|
||||
"comment": ""
|
||||
}
|
||||
|
||||
if __salt__["mysql.check_credentials"]("root", name):
|
||||
ret["comment"]="Password is in correct state"
|
||||
ret["result"] = True
|
||||
return ret
|
||||
|
||||
result = __salt__["mysql.set_root_password"](name)
|
||||
if not result["result"]:
|
||||
ret["comment"] = result["err"]
|
||||
return ret
|
||||
|
||||
ret["changes"].update({"root password": {"old": "######", "new": "******"}})
|
||||
ret["result"]=True
|
||||
return ret
|
Reference in New Issue
Block a user