Closed rjeffman closed 8 months ago
@t-woerner what do you think about calling the method "params_get_with_type_cast"?
Not only this is more explicitly tells what the method is doing, but it also alows for new usage, such as params_get_with_type_cast("aduser", ad_user_type)
, or params_get_with_type_cast("service", list_of(service(ipa_realm))
.
I have the second example in a local "playground branch", and I'm getting fond of the solution for ensuring idempotence in the face of different value types.
(Note: I converted the PR to "draft" so that it is not merged before we are aligned on the method name.)
As discussed offline, I renamed the new method/function to *_get_with_type_cast
, as it explicity says what it is doing, specially in the cases used by PR #1190 (which is based on these changes)
Some parameters, in modules, have a specific data type, but allow the use of an empty string to clear the parameter.
By providing a method to retrieve the parameter with the correct data type, or optionally an empty string, allows for consistency of parameter handling between different modules.
Currently,
ipapwpolicy
andipaidoverrideuser
requires such method, and both were modified to use the module_utils implementation.