From 0ed1e6a1f3fb14cb8ded5587eae54665f02a10f0 Mon Sep 17 00:00:00 2001 From: s-hertel Date: Thu, 2 Feb 2017 09:49:19 -0500 Subject: [PATCH] [cloud] rds module: handle parameters that are False, but also not the default value. Fixes #20370 (#20646) Boolean options that default as `None` but are set to `False` by the user were ignored on update. This change checks to distinguish None & False so that options like multi_az can be turned off during an update. * Modifying how optional parameters are handled in rds.py. Fixes #20370 Allowing options to be set to false/no. Previously ignored unless set to true/yes. Added a conditional for invalid parameters since the default is false instead of null for some options (e.g. force_failover, apply_immediately, upgrade). * Making requested revision. --- lib/ansible/modules/cloud/amazon/rds.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/rds.py b/lib/ansible/modules/cloud/amazon/rds.py index efb7a5bb9b7..5e0775cf1f3 100644 --- a/lib/ansible/modules/cloud/amazon/rds.py +++ b/lib/ansible/modules/cloud/amazon/rds.py @@ -1001,11 +1001,14 @@ def validate_parameters(required_vars, valid_vars, module): params = {} for (k, v) in optional_params.items(): - if module.params.get(k) and k not in required_vars: + if module.params.get(k) is not None and k not in required_vars: if k in valid_vars: params[v] = module.params[k] else: - module.fail_json(msg="Parameter %s is not valid for %s command" % (k, command)) + if module.params.get(k) == False: + pass + else: + module.fail_json(msg="Parameter %s is not valid for %s command" % (k, command)) if module.params.get('security_groups'): params[sec_group] = module.params.get('security_groups').split(',')