The ansible-test’s validate-modules sanity test that comes with ansible-core devel now has a new check for option names and aliases that are equal up to casing, but do not belong to the same option. These will be flagged with the option-equal-up-to-casing
error code. This was added in validate-modules: reject option/alias names equal up to casing belonging to different options by felixfontein · Pull Request #83530 · ansible/ansible · GitHub.
This happens for example if you have two options, foo
and bar
, and bar
has an alias Foo
. Or if you have two distinct options foo
and foO
. This generally indicates bad module/plugin UX or even bugs.
For example, if you have two distinct options, timeout
and timeOut
, one of them should be an alias of the other - it is very surprising if they would have different meaning (i.e. set two different timeouts).
Another example is a plugin which has an option name
, and another option net_name
which has an alias name
. If the user sets name
, they set both options to that value. (If net_name
is also provided, you actually have to dwell through the option management to find out whether it beats name
or not.) This is very likely a bug/oversight which so far wasn’t indicated by the sanity tests.
(You can still have names that are equal up to casing for the same option. If timeOut
is an alias for the option timeout
, the new check will not complain about that. That’s a valid use-case for aliases - you should still check out [Vote ended on 2024-07-02] Avoid using aliases for module options though.)