-
Notifications
You must be signed in to change notification settings - Fork 287
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
Make user_medias optional/override #261
Comments
Thank you @elrondvega for the feature idea. The zabbix_user module isn’t currently an assumption of manual operation. But, I understand your feeling. |
This closely relates to what I have been observing with zabbix_host and other modules. Instead of defaulting to empty iterable that is not even required by Zabbix API we should default to None. This would give us freedom that we don't need to care about such parameters, just ignore everything from module.params that has such value. This will ofc only work when we remove any parameters with None value from |
Sorry maybe I need to clarify, the module shouldn't assume just because something isn't set that it should be erased.
Ansible should only manage and configure the things it has been configured to manage, it shouldn't assume just because something isn't set/configured, that is should just remove those settings. |
Unfortunately, an error occurred that I tried after I change the user_media default value from list to None. https://www.zabbix.com/documentation/5.0/manual/api/reference/user/create If implementation of this request feature to the module, it needs to get the existing user_media configures from Zabbix Server and include the configures to request_data when updating a Zabbix user. |
I was able to implement this change without querying the current state as the field is optional. I will submit a pull request. |
Exactly. I meant my previous comment for all options that are not required. We should default those to None and then remove every None from the request data before sending create/update API calls |
I see, That's what you mean. |
SUMMARY
Currently with the way user_medias works it overrides anything the end-user may have manually configured, even when user_medias isn't set, its defaulting to an empty array which is removing any configuration the user may have done manually. Per the API documentation the user_medias field is optional.
Don't update the user_medias when not set and/or provide an override setting like passwd has.
ISSUE TYPE
COMPONENT NAME
zabbix_user
ADDITIONAL INFORMATION
The text was updated successfully, but these errors were encountered: