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
actually show plugin config warnings/deprecations #82593
base: devel
Are you sure you want to change the base?
Conversation
cc @briantist |
5c448b8
to
197e566
Compare
3e441e4
to
7824434
Compare
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.
A few suggestions
did I misread the standard, is |
@s-hertel updated to accept 'both ways' .. we can punt on standardizing on one or the other for now. |
@briantist @felixfontein , would like to merge this soon, comments? |
}, | ||
Exclusive('singular', 'alt', msg=alt_msg): { | ||
Required('alternative'): doc_string | ||
}, |
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.
The above does not work. It rejects both alternatives
and alternative
with errors like extra keys not allowed @ data['deprecated']['alternative'].
. Basically doing what you want isn't easily supported with voluptuous (see alecthomas/voluptuous#115), adding your own validator to make sure one of them is there is probably the best (similar to alecthomas/voluptuous#115 (comment)).
Try running this PR against a module that is deprecated (you can find some examples in community.general for example). (Would be good to have a test for that in ansible-core's integration tests for this as well.)
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.
We had very few deprecation message tests, the file above adds a bunch but i still had some 'todo' cases
https://github.com/ansible/ansible/pull/82593/files#diff-a06276ae256ddf23396903d5813205f1ed799ab8e5f687c5adc87de6a4233863R37
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.
surprised this does not work, since it took it from the docs example
http://alecthomas.github.io/voluptuous/docs/_build/html/voluptuous.html#module-voluptuous.schema_builder
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.
I guess you refer to:
msg = 'Please, use only one type of authentication at the same time.'
schema = Schema({
Exclusive('classic', 'auth', msg=msg):{
Required('email'): str,
Required('password'): str
},
Exclusive('internal', 'auth', msg=msg):{
Required('secret_key'): str
},
Exclusive('social', 'auth', msg=msg):{
Required('social_network'): str,
Required('token'): str
}
})
The example shows something else, as you can see from the code fragment which uses it:
with raises(er.MultipleInvalid, "Please, use only one type of authentication at the same time. @ data[<auth>]"):
schema({'classic': {'email': 'foo@example.com', 'password': 'bar'},
'social': {'social_network': 'barfoo', 'token': 'tEMp'}})
There you can see that classic
and social
are sub-dictionaries, and email
/password
/... are not top-level keys.
Looked over the code, no specific comments, but very much looking forward to this |
two: | ||
description: | ||
- second option | ||
deprecated: |
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.
Since when is deprecated
allowed for module option docs? Since this is new and intended, it should be mentioned in the changelog.
(Also schema.py
in this PR is still disallowing this for plugin_type == 'module'
.)
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.
They were allowed since deprecations were added for docs, but I don't think it has been used more than 1 or 2 times. I'll update schema too, not sure why that was disabled there, since 'per option deprecation' existed for modules much longer than for plugins.
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.
most of the time we just used aliases to rename an option and keep old name as alias/backwards compat, I don't think we've removed an option from a module since 1.0
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.
Option deprecations for modules were allowed, but documenting them with deprecated
never was so far.
most of the time we just used aliases to rename an option and keep old name as alias/backwards compat, I don't think we've removed an option from a module since 1.0
I think this happened quite a lot, especially in collections, but also in ansible/ansible. Actually it even happened in ansible-core: 9f82fc2 Some removals from Ansible 2.9: 808bf02 88f0c85
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.
Option deprecations for modules were allowed, but documenting them with
deprecated
never was so far.
It was, for most of Ansible's lifetime there were no restrictions on docs, mostly a few requirements. The core engine still does not implement many restrictions.
The restrictions on docs are a relatively recent development in the 12yr lifetime of the project and part of CI/site docs build, not the runtime.
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.
Strict validation of module option docs (which effectively disallowed deprecated
in it) was added in 04e816e, which is now there for a bit over 7 years. That's more than half of the 12 years you mentioned.
previouslly we recorded but did not show to avoid spam since we could not dedup from forks, that was already fixed in another PR so now we can show/display them. Also: * funcitonalize deprecation msg construct from docs * reuse formatting func in cli * normalize alternatives: most of the code used intended plural but some and most data/tests used the singular Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Now deduped globally
ISSUE TYPE