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

simplify "ensure_*" method return values #174

Open
ktdreyer opened this issue Jun 22, 2020 · 0 comments
Open

simplify "ensure_*" method return values #174

ktdreyer opened this issue Jun 22, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@ktdreyer
Copy link
Owner

Many modules call ensure_*() helper methods, for example ensure_inheritance(). Most of these methods return a full result dict with two keys: changed (bool) and stdout_lines (list).

It's complicated and unnecessary to return a dict from all of these helper methods. This makes the code harder to understand. We can update the helper methods to return a simple list of changes instead. If a helper returns an empty list, we know there were no changes.

We only need to assemble a result dict with changed and stdout_lines keys one time: in our main method when we call module.exit_json(**result).

@ktdreyer ktdreyer added the enhancement New feature or request label Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant