diff --git a/changelogs/fragments/40-mysql_user_fix_error_when_host_all_used.yml b/changelogs/fragments/40-mysql_user_fix_error_when_host_all_used.yml new file mode 100644 index 0000000..8676e61 --- /dev/null +++ b/changelogs/fragments/40-mysql_user_fix_error_when_host_all_used.yml @@ -0,0 +1,2 @@ +bugfixes: +- mysql_user - fix module's crash when modifying a user with ``host_all`` (https://github.com/ansible-collections/community.mysql/issues/39). diff --git a/plugins/modules/mysql_user.py b/plugins/modules/mysql_user.py index 8d6c36a..2cdc6a4 100644 --- a/plugins/modules/mysql_user.py +++ b/plugins/modules/mysql_user.py @@ -527,7 +527,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted, old_user_mgmt = use_old_user_mgmt(cursor) if host_all: - hostnames = user_get_hostnames(cursor, [user]) + hostnames = user_get_hostnames(cursor, user) else: hostnames = [host] diff --git a/tests/integration/targets/test_mysql_user/tasks/main.yml b/tests/integration/targets/test_mysql_user/tasks/main.yml index 04c90f3..0e9f7b4 100644 --- a/tests/integration/targets/test_mysql_user/tasks/main.yml +++ b/tests/integration/targets/test_mysql_user/tasks/main.yml @@ -196,6 +196,7 @@ name: '{{ user_name_1 }}' priv: '%db.*:INSERT' append_privs: yes + host_all: yes password: '{{ user_password_1 }}' - name: show grants access for user1 on multiple database