[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.
This commit is contained in:
s-hertel 2017-02-02 09:49:19 -05:00 committed by Ryan Brown
parent c33812450e
commit 0ed1e6a1f3

View file

@ -1001,9 +1001,12 @@ def validate_parameters(required_vars, valid_vars, module):
params = {} params = {}
for (k, v) in optional_params.items(): 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: if k in valid_vars:
params[v] = module.params[k] params[v] = module.params[k]
else:
if module.params.get(k) == False:
pass
else: else:
module.fail_json(msg="Parameter %s is not valid for %s command" % (k, command)) module.fail_json(msg="Parameter %s is not valid for %s command" % (k, command))