Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a loop to manage optional parameters #1

Closed
schurzi opened this issue Aug 14, 2020 · 0 comments · Fixed by #3
Closed

Use a loop to manage optional parameters #1

schurzi opened this issue Aug 14, 2020 · 0 comments · Fixed by #3
Labels
enhancement New feature or request minor

Comments

@schurzi
Copy link
Contributor

schurzi commented Aug 14, 2020

avoid boilderplate and refactor the many if conditions in a single loop

# handle optional options
if "mongoDBMajorVersion" in module.params:
data.update(
{"mongoDBMajorVersion": module.params["mongoDBMajorVersion"]}
)
if "autoScaling" in module.params:
data.update({"autoScaling": module.params["autoScaling"]})
if "diskSizeGB" in module.params:
data.update({"diskSizeGB": module.params["diskSizeGB"]})
if "providerBackupEnabled" in module.params:
data.update(
{"providerBackupEnabled": module.params["providerBackupEnabled"]}
)
if "pitEnabled" in module.params:
data.update({"pitEnabled": module.params["pitEnabled"]})

@schurzi schurzi added enhancement New feature or request minor labels Aug 14, 2020
@schurzi schurzi linked a pull request Aug 14, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant