You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Many modules call
ensure_*()
helper methods, for exampleensure_inheritance()
. Most of these methods return a fullresult
dict with two keys:changed
(bool) andstdout_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 withchanged
andstdout_lines
keys one time: in our main method when we callmodule.exit_json(**result)
.The text was updated successfully, but these errors were encountered: