mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-05 13:44:25 -07:00
Fix typos, enhance formatting, limit line length to 120
This commit is contained in:
parent
4786a40f9d
commit
cadc8438dc
7 changed files with 22 additions and 16 deletions
|
@ -55,7 +55,7 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="Failed to parse %s: %s" % (config_file, to_native(e)))
|
module.fail_json(msg="Failed to parse %s: %s" % (config_file, to_native(e)))
|
||||||
|
|
||||||
# Override some commond defaults with values from config file if needed
|
# Override some common defaults with values from config file if needed
|
||||||
if cp and cp.has_section('client'):
|
if cp and cp.has_section('client'):
|
||||||
try:
|
try:
|
||||||
module.params['login_host'] = cp.get('client', 'host', fallback=module.params['login_host'])
|
module.params['login_host'] = cp.get('client', 'host', fallback=module.params['login_host'])
|
||||||
|
|
|
@ -162,7 +162,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
version_added: '2.3.3'
|
version_added: '2.3.3'
|
||||||
|
|
||||||
seealso:
|
see also:
|
||||||
- module: community.mysql.mysql_info
|
- module: community.mysql.mysql_info
|
||||||
- module: community.mysql.mysql_variables
|
- module: community.mysql.mysql_variables
|
||||||
- module: community.mysql.mysql_user
|
- module: community.mysql.mysql_user
|
||||||
|
@ -335,7 +335,10 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.mysql.plugins.module_utils.database import mysql_quote_identifier
|
from ansible_collections.community.mysql.plugins.module_utils.database import mysql_quote_identifier
|
||||||
from ansible_collections.community.mysql.plugins.module_utils.mysql import mysql_connect, mysql_driver, mysql_driver_fail_msg, mysql_common_argument_spec
|
from ansible_collections.community.mysql.plugins.module_utils.mysql import (
|
||||||
|
mysql_connect, mysql_driver,
|
||||||
|
mysql_driver_fail_msg, mysql_common_argument_spec
|
||||||
|
)
|
||||||
from ansible.module_utils.six.moves import shlex_quote
|
from ansible.module_utils.six.moves import shlex_quote
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
@ -520,7 +523,7 @@ def db_import(module, host, user, password, db_name, target, all_databases, port
|
||||||
return p2.returncode, stdout2, stderr2
|
return p2.returncode, stdout2, stderr2
|
||||||
else:
|
else:
|
||||||
# Used to prevent 'Broken pipe' errors that
|
# Used to prevent 'Broken pipe' errors that
|
||||||
# occasionaly occur when target files are compressed.
|
# occasionally occur when target files are compressed.
|
||||||
# FYI: passing the `shell=True` argument to p2 = subprocess.Popen()
|
# FYI: passing the `shell=True` argument to p2 = subprocess.Popen()
|
||||||
# doesn't solve the problem.
|
# doesn't solve the problem.
|
||||||
cmd = " ".join(cmd)
|
cmd = " ".join(cmd)
|
||||||
|
@ -670,8 +673,8 @@ def main():
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if os.path.exists(config_file):
|
if os.path.exists(config_file):
|
||||||
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
|
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s "
|
||||||
"Exception message: %s" % (config_file, to_native(e)))
|
"has the credentials. Exception message: %s" % (config_file, to_native(e)))
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="unable to find %s. Exception message: %s" % (config_file, to_native(e)))
|
module.fail_json(msg="unable to find %s. Exception message: %s" % (config_file, to_native(e)))
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,8 @@ engines:
|
||||||
returned: if not excluded by filter
|
returned: if not excluded by filter
|
||||||
type: dict
|
type: dict
|
||||||
sample:
|
sample:
|
||||||
- { "CSV": { "Comment": "CSV storage engine", "Savepoints": "NO", "Support": "YES", "Transactions": "NO", "XA": "NO" } }
|
- { "CSV": { "Comment": "CSV storage engine", "Savepoints": "NO", "Support": "YES", "Transactions": "NO",
|
||||||
|
"XA": "NO" } }
|
||||||
master_status:
|
master_status:
|
||||||
description: Master status information.
|
description: Master status information.
|
||||||
returned: if master
|
returned: if master
|
||||||
|
@ -196,7 +197,8 @@ slave_status:
|
||||||
returned: if standby
|
returned: if standby
|
||||||
type: dict
|
type: dict
|
||||||
sample:
|
sample:
|
||||||
- { "192.168.1.101": { "3306": { "replication_user": { "Connect_Retry": 60, "Exec_Master_Log_Pos": 769, "Last_Errno": 0 } } } }
|
- { "192.168.1.101": { "3306": { "replication_user": { "Connect_Retry": 60, "Exec_Master_Log_Pos": 769,
|
||||||
|
"Last_Errno": 0 } } } }
|
||||||
slave_hosts:
|
slave_hosts:
|
||||||
description: Slave status information.
|
description: Slave status information.
|
||||||
returned: if master
|
returned: if master
|
||||||
|
@ -341,7 +343,7 @@ class MySQL_Info(object):
|
||||||
self.info['engines'][engine][vname] = val
|
self.info['engines'][engine][vname] = val
|
||||||
|
|
||||||
def __convert(self, val):
|
def __convert(self, val):
|
||||||
"""Convert unserializable data."""
|
"""Convert un-serializable data."""
|
||||||
try:
|
try:
|
||||||
if isinstance(val, Decimal):
|
if isinstance(val, Decimal):
|
||||||
val = float(val)
|
val = float(val)
|
||||||
|
@ -564,8 +566,8 @@ def main():
|
||||||
check_hostname=check_hostname,
|
check_hostname=check_hostname,
|
||||||
connect_timeout=connect_timeout, cursor_class='DictCursor')
|
connect_timeout=connect_timeout, cursor_class='DictCursor')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
|
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s "
|
||||||
"Exception message: %s" % (config_file, to_native(e)))
|
"has the credentials. Exception message: %s" % (config_file, to_native(e)))
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# Create object and do main job
|
# Create object and do main job
|
||||||
|
|
|
@ -43,7 +43,8 @@ options:
|
||||||
- Where passed queries run in a single transaction (C(yes)) or commit them one-by-one (C(no)).
|
- Where passed queries run in a single transaction (C(yes)) or commit them one-by-one (C(no)).
|
||||||
type: bool
|
type: bool
|
||||||
default: no
|
default: no
|
||||||
seealso:
|
|
||||||
|
see also:
|
||||||
- module: community.mysql.mysql_db
|
- module: community.mysql.mysql_db
|
||||||
author:
|
author:
|
||||||
- Andrew Klychkov (@Andersson007)
|
- Andrew Klychkov (@Andersson007)
|
||||||
|
|
|
@ -188,7 +188,7 @@ extends_documentation_fragment:
|
||||||
- community.mysql.mysql
|
- community.mysql.mysql
|
||||||
|
|
||||||
|
|
||||||
seealso:
|
see also:
|
||||||
- module: community.mysql.mysql_info
|
- module: community.mysql.mysql_info
|
||||||
- name: MySQL replication reference
|
- name: MySQL replication reference
|
||||||
description: Complete reference of the MySQL replication documentation.
|
description: Complete reference of the MySQL replication documentation.
|
||||||
|
|
|
@ -111,7 +111,7 @@ notes:
|
||||||
If you want to avoid this behavior, set I(set_default_role_all) to C(no).
|
If you want to avoid this behavior, set I(set_default_role_all) to C(no).
|
||||||
- Supports C(check_mode).
|
- Supports C(check_mode).
|
||||||
|
|
||||||
seealso:
|
see also:
|
||||||
- module: community.mysql.mysql_user
|
- module: community.mysql.mysql_user
|
||||||
- name: MySQL role reference
|
- name: MySQL role reference
|
||||||
description: Complete reference of the MySQL role documentation.
|
description: Complete reference of the MySQL role documentation.
|
||||||
|
|
|
@ -415,8 +415,8 @@ def main():
|
||||||
connect_timeout=connect_timeout, check_hostname=check_hostname
|
connect_timeout=connect_timeout, check_hostname=check_hostname
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
|
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s "
|
||||||
"Exception message: %s" % (config_file, to_native(e)))
|
"has the credentials. Exception message: %s" % (config_file, to_native(e)))
|
||||||
|
|
||||||
if not sql_log_bin:
|
if not sql_log_bin:
|
||||||
cursor.execute("SET SQL_LOG_BIN=0;")
|
cursor.execute("SET SQL_LOG_BIN=0;")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue