From 596743374b7f6c74a9deb08de23971b964f8c15a Mon Sep 17 00:00:00 2001 From: SoledaD208 Date: Mon, 21 Oct 2024 22:20:35 +0700 Subject: [PATCH] improve the test file and add fragment files for issue 671 --- changelogs/fragments/671-modules_util_user.yml | 12 ++++++++++++ .../targets/test_mysql_user/tasks/issue-671.yaml | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/671-modules_util_user.yml diff --git a/changelogs/fragments/671-modules_util_user.yml b/changelogs/fragments/671-modules_util_user.yml new file mode 100644 index 0000000..a913651 --- /dev/null +++ b/changelogs/fragments/671-modules_util_user.yml @@ -0,0 +1,12 @@ +bugfixes: + - mysql_user,mysql_role - The sql_mode ANSI_QUOTES affects how the modules mysql_user + and mysql_role compare the existing privileges with the configured privileges, + as well as decide whether double quotes or backticks should be used in the GRANT + statements. Pointing out in issue 671, the modules mysql_user and mysql_role allow + users to enable/disable ANSI_QUOTES in session variable (within a DB session, the + session variable always overwrites the global one). But due to the issue, the modules + do not check for ANSI_MODE in the session variable, instead, they only check in the + GLOBAL one.That behavior is not only limiting the users' flexibility, but also not + allowing users to explicitly disable ANSI_MODE to work around such bugs like + https://bugs.mysql.com/bug.php?id=115953. + (https://github.com/ansible-collections/community.mysql/issues/671) \ No newline at end of file diff --git a/tests/integration/targets/test_mysql_user/tasks/issue-671.yaml b/tests/integration/targets/test_mysql_user/tasks/issue-671.yaml index 384c3ce..fa3d321 100644 --- a/tests/integration/targets/test_mysql_user/tasks/issue-671.yaml +++ b/tests/integration/targets/test_mysql_user/tasks/issue-671.yaml @@ -40,6 +40,11 @@ query: 'select @@GLOBAL.sql_mode AS sql_mode' register: sql_mode_orig + - name: Issue-671| Assert sql_mode_orig + assert: + that: + - sql_mode_orig.query_result[0][0].sql_mode != None + - name: Issue-671| enable sql_mode ANSI_QUOTES mysql_variables: <<: *mysql_params @@ -47,11 +52,6 @@ value: '{{ sql_mode_orig.query_result[0][0].sql_mode }},ANSI_QUOTES' mode: "{% if db_engine == 'mariadb' %}global{% else %}persist{% endif %}" - - name: Issue-671| test setup | get value of GLOBAL.sql_mode - mysql_query: - <<: *mysql_params - query: 'select @@GLOBAL.sql_mode' - - name: Issue-671| Copy SQL scripts to remote copy: src: "{{ item }}"