mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-10 10:19:10 -07:00
Fix for int port assignment in a playbook failing
Ports are integer values but the old code was assuming they were strings. When login_port is put into playbook complex_args as an integer the code would fail. This update should make the argument validating make sure we have an integer and then we can send that value directly to the relevant APIs. Fixes #818
This commit is contained in:
parent
49511ea078
commit
e5ba4e87d8
2 changed files with 12 additions and 9 deletions
|
@ -424,7 +424,7 @@ def connect(module, login_user, login_password):
|
|||
if module.params["login_unix_socket"]:
|
||||
db_connection = MySQLdb.connect(host=module.params["login_host"], unix_socket=module.params["login_unix_socket"], user=login_user, passwd=login_password, db="mysql")
|
||||
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")
|
||||
return db_connection.cursor()
|
||||
|
||||
# ===========================================
|
||||
|
@ -437,7 +437,7 @@ def main():
|
|||
login_user=dict(default=None),
|
||||
login_password=dict(default=None),
|
||||
login_host=dict(default="localhost"),
|
||||
login_port=dict(default="3306"),
|
||||
login_port=dict(default=3306, type='int'),
|
||||
login_unix_socket=dict(default=None),
|
||||
user=dict(required=True, aliases=['name']),
|
||||
password=dict(default=None),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue