[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.
pull/20976/head
s-hertel 8 years ago committed by Ryan Brown
parent c33812450e
commit 0ed1e6a1f3

@ -1001,11 +1001,14 @@ 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: 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'): if module.params.get('security_groups'):
params[sec_group] = module.params.get('security_groups').split(',') params[sec_group] = module.params.get('security_groups').split(',')

Loading…
Cancel
Save