mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 11:40:33 -07:00
fix warning to be displayed only when option is not set by the user
This commit is contained in:
parent
7e2449813c
commit
2d2e56d13a
3 changed files with 13 additions and 12 deletions
|
@ -128,7 +128,6 @@ options:
|
||||||
feature was introduced but since MySQL/MariaDB is case sensitive you should set this
|
feature was introduced but since MySQL/MariaDB is case sensitive you should set this
|
||||||
to C(true) in most cases.
|
to C(true) in most cases.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
|
||||||
version_added: '3.8.0'
|
version_added: '3.8.0'
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
|
@ -970,7 +969,7 @@ def main():
|
||||||
check_implicit_admin=dict(type='bool', default=False),
|
check_implicit_admin=dict(type='bool', default=False),
|
||||||
set_default_role_all=dict(type='bool', default=True),
|
set_default_role_all=dict(type='bool', default=True),
|
||||||
members_must_exist=dict(type='bool', default=True),
|
members_must_exist=dict(type='bool', default=True),
|
||||||
column_case_sensitive=dict(type='bool', default=False),
|
column_case_sensitive=dict(type='bool', default=None), # TODO 4.0.0 add default=True
|
||||||
)
|
)
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
@ -1018,6 +1017,11 @@ def main():
|
||||||
if mysql_driver is None:
|
if mysql_driver is None:
|
||||||
module.fail_json(msg=mysql_driver_fail_msg)
|
module.fail_json(msg=mysql_driver_fail_msg)
|
||||||
|
|
||||||
|
# TODO Release 4.0.0 : Remove this test and variable assignation
|
||||||
|
if column_case_sensitive is None:
|
||||||
|
column_case_sensitive = False
|
||||||
|
module.warn("Option column_case_sensitive not provided, column's name will be uppercased")
|
||||||
|
|
||||||
cursor = None
|
cursor = None
|
||||||
try:
|
try:
|
||||||
if check_implicit_admin:
|
if check_implicit_admin:
|
||||||
|
@ -1087,10 +1091,6 @@ def main():
|
||||||
try:
|
try:
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if not role.exists:
|
if not role.exists:
|
||||||
# TODO Release 4.0.0 : Remove this warning or change the message.
|
|
||||||
if not column_case_sensitive and "(" in str(priv):
|
|
||||||
module.warn("column_case_sensitive set to False, column's name will be uppercased")
|
|
||||||
|
|
||||||
if subtract_privs:
|
if subtract_privs:
|
||||||
priv = None # avoid granting unwanted privileges
|
priv = None # avoid granting unwanted privileges
|
||||||
if detach_members:
|
if detach_members:
|
||||||
|
|
|
@ -163,7 +163,6 @@ options:
|
||||||
- This feature was introduced because MySQL 8 and above uses case sensitive
|
- This feature was introduced because MySQL 8 and above uses case sensitive
|
||||||
fields names in privileges.
|
fields names in privileges.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
|
||||||
version_added: '3.8.0'
|
version_added: '3.8.0'
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
|
@ -414,7 +413,7 @@ def main():
|
||||||
resource_limits=dict(type='dict'),
|
resource_limits=dict(type='dict'),
|
||||||
force_context=dict(type='bool', default=False),
|
force_context=dict(type='bool', default=False),
|
||||||
session_vars=dict(type='dict'),
|
session_vars=dict(type='dict'),
|
||||||
column_case_sensitive=dict(type='bool', default=False)
|
column_case_sensitive=dict(type='bool', default=None), # TODO 4.0.0 add default=True
|
||||||
)
|
)
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
@ -477,6 +476,11 @@ def main():
|
||||||
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 has the credentials. "
|
||||||
"Exception message: %s" % (config_file, to_native(e)))
|
"Exception message: %s" % (config_file, to_native(e)))
|
||||||
|
|
||||||
|
# TODO Release 4.0.0 : Remove this test and variable assignation
|
||||||
|
if column_case_sensitive is None:
|
||||||
|
column_case_sensitive = False
|
||||||
|
module.warn("Option column_case_sensitive not provided, column's name will be uppercased")
|
||||||
|
|
||||||
if not sql_log_bin:
|
if not sql_log_bin:
|
||||||
cursor.execute("SET SQL_LOG_BIN=0;")
|
cursor.execute("SET SQL_LOG_BIN=0;")
|
||||||
|
|
||||||
|
@ -491,9 +495,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=to_native(e))
|
||||||
|
|
||||||
# TODO Release 4.0.0 : Remove this warning or change the message.
|
|
||||||
if not column_case_sensitive and "(" in str(priv):
|
|
||||||
module.warn("column_case_sensitive set to False, column's name will be uppercased")
|
|
||||||
priv = privileges_unpack(priv, mode, column_case_sensitive, ensure_usage=not subtract_privs)
|
priv = privileges_unpack(priv, mode, column_case_sensitive, ensure_usage=not subtract_privs)
|
||||||
password_changed = False
|
password_changed = False
|
||||||
if state == "present":
|
if state == "present":
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
# ================= Reproduce failure =====================================
|
# ================= Reproduce failure =====================================
|
||||||
|
|
||||||
- name: Mysql_user Column case sensitive | Create users
|
- name: Mysql_user Column case sensitive | Create test user
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
name: column_case_sensitive
|
name: column_case_sensitive
|
||||||
|
|
Loading…
Add table
Reference in a new issue