Add version_added and type of parameter

pull/18777/head
acaveroc 10 years ago committed by Matt Clay
parent 2c6f69c95e
commit dda41fd95a

@ -53,6 +53,7 @@ options:
- mysql host to connect - mysql host to connect
required: False required: False
login_port: login_port:
version_added: "1.9"
description: description:
- mysql port to connect - mysql port to connect
required: False required: False
@ -198,7 +199,7 @@ def main():
login_user=dict(default=None), login_user=dict(default=None),
login_password=dict(default=None), login_password=dict(default=None),
login_host=dict(default="127.0.0.1"), login_host=dict(default="127.0.0.1"),
login_port=dict(default="3306"), 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)
@ -233,9 +234,9 @@ def main():
module.fail_json(msg="when supplying login arguments, both login_user and login_password must be provided") module.fail_json(msg="when supplying login arguments, both login_user and login_password must be provided")
try: try:
if module.params["login_unix_socket"]: if module.params["login_unix_socket"]:
db_connection = MySQLdb.connect(host=module.params["login_host"], port=int(module.params["login_port"]), unix_socket=module.params["login_unix_socket"], user=login_user, passwd=login_password, db="mysql") db_connection = MySQLdb.connect(host=module.params["login_host"], port=module.params["login_port"], unix_socket=module.params["login_unix_socket"], user=login_user, passwd=login_password, db="mysql")
else: else:
db_connection = MySQLdb.connect(host=module.params["login_host"], port=int(module.params["login_port"]), user=login_user, passwd=login_password, db="mysql") db_connection = MySQLdb.connect(host=module.params["login_host"], port=module.params["login_port"], user=login_user, passwd=login_password, db="mysql")
cursor = db_connection.cursor() cursor = db_connection.cursor()
except Exception, e: except Exception, e:
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials") module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials")

Loading…
Cancel
Save