From 4c3f8cbd9282bdc230bab80613a3193e5db10bd3 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 16 Nov 2016 05:45:16 -0800 Subject: [PATCH] Do not require password when deleting os_user (#5601) I broke backwards compat with the addition to define when a password should be updated. It was requiring that a password value be passed when deleting a user, which seems silly. This moves the argument logic out of the argument spec and into when it would be needed, when state is present. --- lib/ansible/modules/cloud/openstack/os_user.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_user.py b/lib/ansible/modules/cloud/openstack/os_user.py index 264eb3f8e8..831f2fa9de 100644 --- a/lib/ansible/modules/cloud/openstack/os_user.py +++ b/lib/ansible/modules/cloud/openstack/os_user.py @@ -191,10 +191,6 @@ def main(): module_kwargs = openstack_module_kwargs() module = AnsibleModule( argument_spec, - required_if=[ - ('update_password', 'always', ['password']), - ('update_password', 'on_create', ['password']), - ], **module_kwargs) if not HAS_SHADE: @@ -219,6 +215,11 @@ def main(): domain_id = _get_domain_id(opcloud, domain) if state == 'present': + if update_password in ('always', 'on_create'): + if not password: + msg = ("update_password is %s but a password value is " + "missing") % update_password + self.fail_json(msg=msg) default_project_id = None if default_project: default_project_id = _get_default_project_id(cloud, default_project)