Skip to content

Commit

Permalink
mysql_user: deprecate alias user for name argument (#670)
Browse files Browse the repository at this point in the history
* mysql_user: deprecate alias user for name argument
* Fix module and tests
  • Loading branch information
Andersson007 authored Sep 2, 2024
1 parent 0de9685 commit 59c2621
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/0-mysql_user.yml
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 8 additions & 2 deletions plugins/modules/mysql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@
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'),
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/test_mysql_user/tasks/issue-265.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 59c2621

Please sign in to comment.