From cafbb9100d01cc689daaf64051ebe23a548515a4 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 16 Sep 2025 07:55:45 +0200 Subject: [PATCH] mysql_role: column_case_sensitive default is set to true (#738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * mysql_role: column_case_sensitive default is set to true * Update plugins/modules/mysql_role.py Co-authored-by: Laurent Indermühle --------- Co-authored-by: Laurent Indermühle --- changelogs/fragments/5-case_sensitive2.yml | 2 ++ plugins/modules/mysql_role.py | 13 ++++--------- .../tasks/test_column_case_sensitive.yml | 2 ++ 3 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 changelogs/fragments/5-case_sensitive2.yml diff --git a/changelogs/fragments/5-case_sensitive2.yml b/changelogs/fragments/5-case_sensitive2.yml new file mode 100644 index 0000000..ef46810 --- /dev/null +++ b/changelogs/fragments/5-case_sensitive2.yml @@ -0,0 +1,2 @@ +breaking_changes: +- mysql_role - the ``column_case_sensitive`` argument's default value has been changed to ``true``. If your playbook expected the column to be automatically uppercased for your users privileges, you should set this to ``false`` explicitly (https://github.com/ansible-collections/community.mysql/issues/578). diff --git a/plugins/modules/mysql_role.py b/plugins/modules/mysql_role.py index 96957fc..eb474dc 100644 --- a/plugins/modules/mysql_role.py +++ b/plugins/modules/mysql_role.py @@ -123,12 +123,14 @@ options: column_case_sensitive: description: - - The default is C(false). + - The default is C(true). - When C(true), the module will not uppercase the field in the privileges. - When C(false), the field names will be upper-cased. This was the default before this feature was introduced but since MySQL/MariaDB is case sensitive you should set this to C(true) in most cases. + - The default changed from C(false) to C(true) in v4.0.0 type: bool + default: true version_added: '3.8.0' notes: @@ -972,7 +974,7 @@ def main(): check_implicit_admin=dict(type='bool', default=False), set_default_role_all=dict(type='bool', default=True), members_must_exist=dict(type='bool', default=True), - column_case_sensitive=dict(type='bool', default=None), # TODO 4.0.0 add default=True + column_case_sensitive=dict(type='bool', default=True), ) module = AnsibleModule( argument_spec=argument_spec, @@ -1020,13 +1022,6 @@ def main(): if mysql_driver is None: 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 is not provided. " - "The default is now false, so the column's name will be uppercased. " - "The default will be changed to true in community.mysql 4.0.0.") - cursor = None try: if check_implicit_admin: diff --git a/tests/integration/targets/test_mysql_role/tasks/test_column_case_sensitive.yml b/tests/integration/targets/test_mysql_role/tasks/test_column_case_sensitive.yml index 74849e0..33f95fa 100644 --- a/tests/integration/targets/test_mysql_role/tasks/test_column_case_sensitive.yml +++ b/tests/integration/targets/test_mysql_role/tasks/test_column_case_sensitive.yml @@ -29,6 +29,7 @@ name: column_case_sensitive host: '%' password: 'msandbox' + column_case_sensitive: false # ================= Reproduce failure ===================================== @@ -41,6 +42,7 @@ - 'column_case_sensitive@%' priv: 'mysql_role_column_case.t1': 'SELECT(a, B, cC, Dd)' + column_case_sensitive: false - name: Mysql_role Column case sensitive | Assert role privileges are all caps community.mysql.mysql_query: