mysql_variables: fix inconsistent params, fixes ubuntu 16.04 support

In the mysql_user module, login_host is defined as "localhost". Setting this to localhost also fixes Ubuntu 16.04 support.

To make it more consistent in the future, the params in all mysql modules should move to module utils. I'll take care.

Also fixed a few other things along.
This commit is contained in:
Rene Moser 2016-05-02 18:38:07 +02:00 committed by Matt Clay
parent 82cefd7ce1
commit 6a7682c7ea

View file

@ -51,7 +51,6 @@ EXAMPLES = '''
''' '''
import os
import warnings import warnings
from re import match from re import match
@ -118,9 +117,9 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict( argument_spec = dict(
login_user=dict(default=None), login_user=dict(default=None),
login_password=dict(default=None), login_password=dict(default=None, no_log=True),
login_host=dict(default="127.0.0.1"), login_host=dict(default="localhost"),
login_port=dict(default="3306", type='int'), login_port=dict(default=3306, type='int'),
login_unix_socket=dict(default=None), login_unix_socket=dict(default=None),
variable=dict(default=None), variable=dict(default=None),
value=dict(default=None), value=dict(default=None),
@ -128,19 +127,16 @@ def main():
ssl_key=dict(default=None), ssl_key=dict(default=None),
ssl_ca=dict(default=None), ssl_ca=dict(default=None),
connect_timeout=dict(default=30, type='int'), connect_timeout=dict(default=30, type='int'),
config_file=dict(default="~/.my.cnf") config_file=dict(default="~/.my.cnf", type="path")
) )
) )
user = module.params["login_user"] user = module.params["login_user"]
password = module.params["login_password"] password = module.params["login_password"]
host = module.params["login_host"]
port = module.params["login_port"]
ssl_cert = module.params["ssl_cert"] ssl_cert = module.params["ssl_cert"]
ssl_key = module.params["ssl_key"] ssl_key = module.params["ssl_key"]
ssl_ca = module.params["ssl_ca"] ssl_ca = module.params["ssl_ca"]
connect_timeout = module.params['connect_timeout'] connect_timeout = module.params['connect_timeout']
config_file = module.params['config_file'] config_file = module.params['config_file']
config_file = os.path.expanduser(os.path.expandvars(config_file))
db = 'mysql' db = 'mysql'
mysqlvar = module.params["variable"] mysqlvar = module.params["variable"]
@ -187,4 +183,5 @@ def main():
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.database import * from ansible.module_utils.database import *
from ansible.module_utils.mysql import * from ansible.module_utils.mysql import *
main() if __name__ == '__main__':
main()