mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 19:50:31 -07:00
Update variable name for consistency
This commit is contained in:
parent
56582f52a2
commit
f79ee2b83c
3 changed files with 12 additions and 14 deletions
|
@ -114,7 +114,7 @@ def get_grants(cursor, user, host):
|
||||||
|
|
||||||
|
|
||||||
def get_existing_authentication(cursor, user, host):
|
def get_existing_authentication(cursor, user, host):
|
||||||
# Return the plugin and auth_string if there is exactly one distinct existing plugin and auth_string.
|
# Return the plugin and plugin_auth_string if there is exactly one distinct existing plugin and plugin_auth_string.
|
||||||
|
|
||||||
if get_server_type(cursor) == 'mariadb':
|
if get_server_type(cursor) == 'mariadb':
|
||||||
# before MariaDB 10.2.19 and 10.3.11, "password" and "authentication_string" can differ
|
# before MariaDB 10.2.19 and 10.3.11, "password" and "authentication_string" can differ
|
||||||
|
@ -132,10 +132,10 @@ def get_existing_authentication(cursor, user, host):
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
|
||||||
if isinstance(rows[0], tuple):
|
if isinstance(rows[0], tuple):
|
||||||
return {'plugin': rows[0][0], 'auth_string': rows[0][1]}
|
return {'plugin': rows[0][0], 'plugin_auth_string': rows[0][1]}
|
||||||
|
|
||||||
if isinstance(rows[0], dict):
|
if isinstance(rows[0], dict):
|
||||||
return {'plugin': rows[0].get('plugin'), 'auth_string': rows[0].get('auth')}
|
return {'plugin': rows[0].get('plugin'), 'plugin_auth_string': rows[0].get('auth')}
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ def user_add(cursor, user, host, host_all, password, encrypted,
|
||||||
existing_auth = get_existing_authentication(cursor, user, host)
|
existing_auth = get_existing_authentication(cursor, user, host)
|
||||||
if existing_auth:
|
if existing_auth:
|
||||||
plugin = existing_auth['plugin']
|
plugin = existing_auth['plugin']
|
||||||
plugin_hash_string = existing_auth['auth_string']
|
plugin_hash_string = existing_auth['plugin_auth_string']
|
||||||
password = None
|
password = None
|
||||||
used_existing_password = True
|
used_existing_password = True
|
||||||
if password and encrypted:
|
if password and encrypted:
|
||||||
|
@ -308,7 +308,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
|
||||||
|
|
||||||
if plugin_auth_string and current_plugin[1] != plugin_auth_string:
|
if plugin_auth_string and current_plugin[1] != plugin_auth_string:
|
||||||
# this case can cause more updates than expected,
|
# this case can cause more updates than expected,
|
||||||
# as plugin can hash auth_string in any way it wants
|
# as plugin can hash plugin_auth_string in any way it wants
|
||||||
# and there's no way to figure it out for
|
# and there's no way to figure it out for
|
||||||
# a check, so I prefer to update more often than never
|
# a check, so I prefer to update more often than never
|
||||||
update = True
|
update = True
|
||||||
|
|
|
@ -138,7 +138,8 @@ EXAMPLES = r'''
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
host: "{{ item.host }}"
|
host: "{{ item.host }}"
|
||||||
plugin: "{{ item.plugin | default(omit) }}"
|
plugin: "{{ item.plugin | default(omit) }}"
|
||||||
plugin_auth_string: "{{ item.auth_string | default(omit) }}"
|
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
||||||
|
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
||||||
tls_require: "{{ item.tls_require | default(omit) }}"
|
tls_require: "{{ item.tls_require | default(omit) }}"
|
||||||
priv: "{{ item.priv | default(omit) }}"
|
priv: "{{ item.priv | default(omit) }}"
|
||||||
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
||||||
|
@ -222,7 +223,7 @@ users_privs:
|
||||||
returned: if not excluded by filter
|
returned: if not excluded by filter
|
||||||
type: dict
|
type: dict
|
||||||
sample:
|
sample:
|
||||||
- { "auth_string": '*1234567',
|
- { "plugin_auth_string": '*1234567',
|
||||||
"name": "user1",
|
"name": "user1",
|
||||||
"host": "host.com",
|
"host": "host.com",
|
||||||
"plugin": "mysql_native_password",
|
"plugin": "mysql_native_password",
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
host: "users_privs.com"
|
host: "users_privs.com"
|
||||||
password: '*6C387FC3893DBA1E3BA155E74754DA6682D04747'
|
plugin: "mysql_native_password"
|
||||||
encrypted: true
|
plugin_hash_string: '*6C387FC3893DBA1E3BA155E74754DA6682D04747'
|
||||||
priv: "{{ item.priv }}"
|
priv: "{{ item.priv }}"
|
||||||
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
||||||
state: present
|
state: present
|
||||||
|
@ -107,8 +107,6 @@
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
host: "users_privs.com"
|
host: "users_privs.com"
|
||||||
password: "{{ item.password | default(omit) }}"
|
|
||||||
encrypted: true
|
|
||||||
plugin: "{{ item.plugin | default(omit) }}"
|
plugin: "{{ item.plugin | default(omit) }}"
|
||||||
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
||||||
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
||||||
|
@ -130,8 +128,6 @@
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
host: "users_privs.com"
|
host: "users_privs.com"
|
||||||
password: "{{ item.password | default(omit) }}"
|
|
||||||
encrypted: true
|
|
||||||
plugin: "{{ item.plugin | default(omit) }}"
|
plugin: "{{ item.plugin | default(omit) }}"
|
||||||
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
||||||
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
||||||
|
@ -163,7 +159,8 @@
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
host: "{{ item.host }}"
|
host: "{{ item.host }}"
|
||||||
plugin: "{{ item.plugin | default(omit) }}"
|
plugin: "{{ item.plugin | default(omit) }}"
|
||||||
plugin_auth_string: "{{ item.auth_string | default(omit) }}"
|
plugin_auth_string: "{{ item.plugin_auth_string | default(omit) }}"
|
||||||
|
plugin_hash_string: "{{ item.plugin_hash_string | default(omit) }}"
|
||||||
tls_require: "{{ item.tls_require | default(omit) }}"
|
tls_require: "{{ item.tls_require | default(omit) }}"
|
||||||
priv: "{{ item.priv | default(omit) }}"
|
priv: "{{ item.priv | default(omit) }}"
|
||||||
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
resource_limits: "{{ item.resource_limits | default(omit) }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue