mysql_user: deprecate alias user for name argument (#670)

* mysql_user: deprecate alias user for name argument
* Fix module and tests
This commit is contained in:
Andrew Klychkov 2024-09-02 18:07:11 +02:00 committed by GitHub
parent 0de9685cf1
commit 59c26211ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 8 deletions

View file

@ -0,0 +1,2 @@
breaking_changes:
- mysql_user - the ``user`` alias of the ``name`` argument has been deprecated and will be removed in collection version 5.0.0. Use the ``name`` argument instead.

View file

@ -439,7 +439,13 @@ from ansible.module_utils._text import to_native
def main():
argument_spec = mysql_common_argument_spec()
argument_spec.update(
user=dict(type='str', required=True, aliases=['name']),
name=dict(type='str', required=True, aliases=['user'], deprecated_aliases=[
{
'name': 'user',
'version': '5.0.0',
'collection_name': 'community.mysql',
}],
),
password=dict(type='str', no_log=True),
encrypted=dict(type='bool', default=False),
host=dict(type='str', default='localhost'),
@ -471,7 +477,7 @@ def main():
)
login_user = module.params["login_user"]
login_password = module.params["login_password"]
user = module.params["user"]
user = module.params["name"]
password = module.params["password"]
encrypted = module.boolean(module.params["encrypted"])
host = module.params["host"].lower()

View file

@ -64,7 +64,7 @@
- name: Issue-265 | Remove blank mysql user with hosts=all (expect changed)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
state: absent
force_context: yes
@ -78,7 +78,7 @@
- name: Issue-265 | Remove blank mysql user with hosts=all (expect ok)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
force_context: yes
state: absent
@ -151,7 +151,7 @@
- name: Issue-265 | Remove blank mysql user with hosts=all (expect changed)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
state: absent
force_context: no
@ -165,7 +165,7 @@
- name: Issue-265 | Remove blank mysql user with hosts=all (expect ok)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
force_context: no
state: absent

View file

@ -66,7 +66,7 @@
- name: Idempotency | Remove blank user with hosts=all (expect changed)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
state: absent
register: result
@ -79,7 +79,7 @@
- name: Idempotency | Remove blank user with hosts=all (expect ok)
mysql_user:
<<: *mysql_params
user: ""
name: ""
host_all: true
state: absent
register: result