From 521443a6714fa330637890436b4302b3ff8166cf Mon Sep 17 00:00:00 2001 From: Paul Campbell <118974000+pcampbell-payroc@users.noreply.github.com> Date: Sat, 4 Feb 2023 07:31:00 +0000 Subject: [PATCH] Allow uppercase in variable names for Galera wsrep variables (#501) * Allow uppercase in variable names for Galera wsrep variables * Changelog fragment for regex change * Corrected for excessive line lengths * Update changelogs/fragments/mysql_variables_allow_uppercase_identifiers.yml --------- Co-authored-by: Andrew Klychkov --- .../mysql_variables_allow_uppercase_identifiers.yml | 6 ++++++ plugins/modules/mysql_variables.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/mysql_variables_allow_uppercase_identifiers.yml diff --git a/changelogs/fragments/mysql_variables_allow_uppercase_identifiers.yml b/changelogs/fragments/mysql_variables_allow_uppercase_identifiers.yml new file mode 100644 index 00000000..0d354672 --- /dev/null +++ b/changelogs/fragments/mysql_variables_allow_uppercase_identifiers.yml @@ -0,0 +1,6 @@ +--- +bugfixes: + - mysql_variables - add uppercase character pattern to regex to allow GLOBAL + variables containing uppercase characters. + This recognizes variable names used in Galera, for example, ``wsrep_OSU_method``, + which breaks the normal pattern of all lowercase characters (https://github.com/ansible-collections/community.mysql/pull/501). diff --git a/plugins/modules/mysql_variables.py b/plugins/modules/mysql_variables.py index dc54c822..f404d5aa 100644 --- a/plugins/modules/mysql_variables.py +++ b/plugins/modules/mysql_variables.py @@ -199,7 +199,7 @@ def main(): if mysqlvar is None: module.fail_json(msg="Cannot run without variable to operate with") - if match('^[0-9a-z_.]+$', mysqlvar) is None: + if match('^[0-9A-Za-z_.]+$', mysqlvar) is None: module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar) if mysql_driver is None: module.fail_json(msg=mysql_driver_fail_msg)