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
Role argspec: allow new argument spec file #74582
Conversation
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 probably needs some tests for a spec in meta/main.yml
as well as a test for specs in both meta/main.yml
and meta/argument_specs.yml
to make sure that meta/argument_specs.yml
is preferred. And maybe a test with meta/argument_specs.yaml
to test the multiple file extension support.
I had planned to add the first part. The second part is already covered by some of the file renames. I have some roles using |
Aaaand.... I just realized I hadn't yet pushed up that change with the remaining renames. But yeah, it's covered. :) |
Co-authored-by: Sam Doran <sdoran@redhat.com>
This needs a changelog fragment :) |
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.
LGTM
- choice1 | ||
- choice2 | ||
groot: | ||
short_description: I am Groot |
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.
🤣
* support separate role argspec file in ansible-doc * support separate role argspec file in ansible-core * support both .yml and .yaml extensions on argspec file in ansible-doc * fix filename building bug and rename some argspec files to test variations * use yaml extensions from constants * add superfluous meta/main.yml files to tests * Update lib/ansible/cli/doc.py Co-authored-by: Sam Doran <sdoran@redhat.com> * update docs * ci_complete * add changelog and allow for main.yml variations * add collection role testing Co-authored-by: Sam Doran <sdoran@redhat.com> (cherry picked from commit 8fb5488)
* support separate role argspec file in ansible-core * support both .yml and .yaml extensions on argspec file in ansible-doc * fix filename building bug and rename some argspec files to test variations * use yaml extensions from constants * add superfluous meta/main.yml files to tests * Update lib/ansible/cli/doc.py * update docs * add changelog and allow for main.yml variations * add collection role testing Co-authored-by: Sam Doran <sdoran@redhat.com> (cherry picked from commit 8fb5488)
SUMMARY
Roles containing a defined argument spec in
meta/main.yml
do not currently work on ansible-core versions less than 2.11 because those versions do not allow for theargument_specs
key inmeta/main.yml
. To solve this, we will allow the role arg specs to be defined in a new file (meta/argument_specs.[yml|yaml]
) which will allow updated roles to still work on older versions of ansible-core.Argument specs in
meta/main.yml
will still be supported, but roles choosing to use this file will work only on ansible-core >= 2.11. The new spec file will have precedence overmeta/main.yml
. Data will not be combined between the two files, if both exist.This also adds a new test for collection-based roles that tests both validation success and validation failure.
Fixes #74525
ISSUE TYPE
COMPONENT NAME
roles