[Vote ended on 2024-01-30] Ansible collection inclusion requirements: remove absolute ban of `undocumented-parameter` ignore.txt entry

Right now the Ansible collection inclusion requirements on CI testing explicitly state that undocumented-parameter is one of the errors you MUST NOT ignore in tests/sanity/ignore-*.txt. Some collections in Ansible violate this rule, but (at least the cases I know of) for good reasons.

Proposal: update the collection requirements so that undocumented-parameter in tests/sanity/ignore-*.txt is allowed in specific circumstances:

  1. deprecated parameters;
  2. internal parameters used to transport data from an action plugin to a module.

More precisely, see my PR Collection requirements: undocumented-parameter must only be used for deprecated parameters or internal parameters by felixfontein · Pull Request #989 · ansible/ansible-documentation · GitHub which changes the wording.

Rationale for exception 1: This has been used in the past when removing dangerous parameters to make sure that users get a useful error message. One such case was Remove the params module option from ldap_attr and ldap_entry (#113) · ansible-collections/community.general@11ef03e · GitHub.

Rationale for exception 2: If code has to be spread over both an action plugin and a module, some data often needs to be passed from the action plugin to the module. The only way to do this is to add a module parameter. The validate-modules sanity tests requires this parameter to be documented, which is wrong since the user cannot use that parameter - it is provided directly by the action plugin. Since there is no mechanism to disable the error for a specific module parameter, it needs to be disabled completely. Example: community.docker/plugins/action/docker_container_copy_into.py at main · ansible-collections/community.docker · GitHubcommunity.docker/plugins/modules/docker_container_copy_into.py at main · ansible-collections/community.docker · GitHub.

What do you think?

4 Likes

Exception 1 makes sense to me. Actually, I think it might be worth to reconsider the absolute ban of all ignores for deprecated parameters.

I’m not 100% sure about exception 2. Is it possible to mark a parameter as (collection) internal? Your proposal makes sense, but this would make it easier IMHO: I think it would be easier to (automatically) allow more ignores if parameters are marked as internal only. If it isn’t possible to have collection internal paramaters for modules we might have to talk to the core team to make it possible.

Why not just document it and say it’s for internal use only. While I would love for a way to explicitly mark something as internal only so you don’t have to document it at all, I find that using the ignore files is the wrong thing for something like this.

I find it very strange to document options that cannot (and must not) be used. (Same as for modules/plugins/roles for internal use of a collection.)

If the users provide values for these options, in the best case they receive an error message, and in the worst case the value is simply ignored. So why should they be listed in the documentation at all? We don’t document other random names that cannot be used as options for a module/plugin/role either.

I fully agree with that. In fact I suggested something for that roughly a year ago: Allow to mark module parameters as undocumented / private · Issue #79695 · ansible/ansible · GitHub

This was discussed at a core meeting: Meetbot Logs I don’t remember the details, but the result was that nothing happened, and we still have to add ignore.txt entries that globally disable some error classes for a module/plugin…

1 Like

That’s why I opened Ansible collection inclusion requirements: remove absolute ban of `undocumented-parameter` ignore.txt entry - #3 by jborean a year ago :slight_smile: I would prefer something like that, but right now it’s not possible, and it doesn’t look like it will change anytime soon.

I find it very strange to document options that cannot (and must not) be used. (Same as for modules/plugins/roles for internal use of a collection.)

Sure but I find it stranger to ignore an explicit check rather than just 2-3 lines saying this is internal and not to use. My preference would be to have a common mechanism to mark options as internal/do not use so they don’t have to be documented but turning off the check for the whole documentation might lead to other errors falling through. In the current landscape documenting them as internal to me is the lesser of two evils here.

This probably doesn’t apply too much to this thread but ICYMI, there’s been a change in devel that affects plugin options using config manager:

With that change, attempting to set an option with set_option or set_options that isn’t documented, or is documented with a wrong/incompatible type to its value, will raise an exception.

I wonder if in some cases, that might end up requiring documentation of internal options used in action plugins (though I guess they just would not use config manager).

If there are no new arguments, or objections, I’ll start a vote on this in a few days.

Please vote until 2024-01-30 in the following SC/community vote on whether [WIP] Collection requirements: undocumented-parameter must only be used for deprecated parameters or internal parameters by felixfontein · Pull Request #989 · ansible/ansible-documentation · GitHub should be merged, and with it the absolute ban of undocumented-parameter in tests/sanity/ignore-*.txt removed:

  • Merge PR and remove absolut ban of undocumented-parameter
  • Keep absolute ban of undocumented-parameter
0 voters
0 voters

Counting votes:

  • SC: 7 x +1 (felixfontein, gotmax23, briantist, Andersson007, mariolenz, markuman, gundalow), 1 x -1 (acozine)
  • Community: 2 x +1 (cybette, Leo), 0 x -1

I can confirm your count!

1 Like