Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Apr 24, 2024
1 parent 0ed42df commit bae9117
Showing 1 changed file with 29 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,25 +483,25 @@
- name: Plugin auth | Create user with plugin auth and salt
community.mysql.mysql_user:
<<: *mysql_params
name: '{{ test_user_name }}'
host: '%'
name: "{{ test_user_name }}"
host: "%"
plugin: caching_sha2_password
plugin_auth_string: '{{ test_plugin_auth_string }}'
salt: '{{ test_salt }}'
priv: '{{ test_default_priv }}'
plugin_auth_string: "{{ test_plugin_auth_string }}"
salt: "{{ test_salt }}"
priv: "{{ test_default_priv }}"

- name: Plugin auth | Connect with user and password
ansible.builtin.command: "{{ mysql_command }} -u {{ test_user_name }} -p{{ test_plugin_auth_string }} -e \"SELECT 1\""
ansible.builtin.command: '{{ mysql_command }} -u {{ test_user_name }} -p{{ test_plugin_auth_string }} -e "SELECT 1"'

- name: Plugin auth | Alter user with same plugin auth and same salt
community.mysql.mysql_user:
<<: *mysql_params
name: '{{ test_user_name }}'
host: '%'
name: "{{ test_user_name }}"
host: "%"
plugin: caching_sha2_password
plugin_auth_string: '{{ test_plugin_auth_string }}'
salt: '{{ test_salt }}'
priv: '{{ test_default_priv }}'
plugin_auth_string: "{{ test_plugin_auth_string }}"
salt: "{{ test_salt }}"
priv: "{{ test_default_priv }}"
register: result
failed_when: result is changed

Expand All @@ -510,52 +510,37 @@
vars:
user_name: "{{ test_user_name }}"

- name: Plugin auth | Create user with too short salt
- name: Plugin auth | Create user with too short salt (should fail)
community.mysql.mysql_user:
<<: *mysql_params
name: '{{ test_user_name }}'
host: '%'
name: "{{ test_user_name }}"
host: "%"
plugin: caching_sha2_password
plugin_auth_string: '{{ test_plugin_auth_string }}'
salt: '1234567890az'
priv: '{{ test_default_priv }}'
plugin_auth_string: "{{ test_plugin_auth_string }}"
salt: "1234567890az"
priv: "{{ test_default_priv }}"
register: result
ignore_errors: true

- name: Plugin auth | Assert that shorter salt fails
ansible.builtin.assert:
that:
- result is failed
failed_when: result is success

- name: Plugin auth | Create user with salt and no plugin auth string (should fail)
community.mysql.mysql_user:
<<: *mysql_params
name: '{{ test_user_name }}'
host: '%'
name: "{{ test_user_name }}"
host: "%"
plugin: caching_sha2_password
salt: '{{ test_salt }}'
priv: '{{ test_default_priv }}'
salt: "{{ test_salt }}"
priv: "{{ test_default_priv }}"
register: result
ignore_errors: true

- name: Plugin auth | Assert that missing plugin_auth_string with salt fails
ansible.builtin.assert:
that:
- result is failed
failed_when: result is success

- name: Plugin auth | Create user with salt and plugin not handled by internal hash generation (should fail)
community.mysql.mysql_user:
<<: *mysql_params
name: '{{ test_user_name }}'
host: '%'
name: "{{ test_user_name }}"
host: "%"
plugin: mysql_native_password
plugin_auth_string: '{{ test_plugin_auth_string }}'
salt: '{{ test_salt }}'
priv: '{{ test_default_priv }}'
plugin_auth_string: "{{ test_plugin_auth_string }}"
salt: "{{ test_salt }}"
priv: "{{ test_default_priv }}"
register: result
ignore_errors: true

- name: Plugin auth | Assert that wrong plugin with salt fails
ansible.builtin.assert:
that:
- result is failed
failed_when: result is success

0 comments on commit bae9117

Please sign in to comment.