summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Keating <jkeating@j2solutions.net>2016-11-16 05:45:16 -0800
committerDavid Shrewsbury <Shrews@users.noreply.github.com>2016-11-16 08:45:16 -0500
commitbb97885f91573a8d76c307d03cef1a54702ed3c7 (patch)
treec2e87c1c7b9c20a0eb4013e7e5bc80fd8750143d
parenta0545dc9f83e3d2c3c4a9924460beb76e1c9dba4 (diff)
downloadansible-modules-core-bb97885f91573a8d76c307d03cef1a54702ed3c7.tar.gz
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.
-rw-r--r--cloud/openstack/os_user.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/cloud/openstack/os_user.py b/cloud/openstack/os_user.py
index 264eb3f8..831f2fa9 100644
--- a/cloud/openstack/os_user.py
+++ b/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)