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
Standardize algorithm to verify if invalid argument was used. #652
Merged
t-woerner
merged 26 commits into
freeipa:master
from
rjeffman:ipaansiblemodule_fail_if_invalid
Oct 4, 2021
Merged
Standardize algorithm to verify if invalid argument was used. #652
t-woerner
merged 26 commits into
freeipa:master
from
rjeffman:ipaansiblemodule_fail_if_invalid
Oct 4, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rjeffman
force-pushed
the
ipaansiblemodule_fail_if_invalid
branch
from
October 1, 2021 00:28
308b317
to
31bc6fe
Compare
Almost all modules require an algorithm ta validade if the user provided arguments for the playbook are valid for the requested state and/or action. This patch provides a function that tests if any of a list of arguments were set, and fail with a standardized message, making all modules fail in the same way.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
Use the IPAAnsibleModule.params_fail_if_used method to validate arguments provided by user.
rjeffman
force-pushed
the
ipaansiblemodule_fail_if_invalid
branch
from
October 1, 2021 12:50
31bc6fe
to
0fac277
Compare
rjeffman
changed the title
WIP: Standardize algorithm no verify if invalid argument was used.
Standardize algorithm no verify if invalid argument was used.
Oct 1, 2021
rjeffman
changed the title
Standardize algorithm no verify if invalid argument was used.
Standardize algorithm to verify if invalid argument was used.
Oct 1, 2021
t-woerner
approved these changes
Oct 4, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Almost all modules use a similar algorithm to validate if parameters
should not have had a value provided by user, and as the algorithm is
implemented in each method, errors may occur, and error messages
may differ.
This PR proposes the use of a common procedure for all modules, based on
an IPAAnsibleModule method. The module provides a list of attributes that
shuld be null for the state/action requested, and the execution fails if one of
those attributes value is not None.