Open gardar opened 3 weeks ago
Files identified in the description:
None
If these files are incorrect, please update the component name
section of the description or use the component bot command.
Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the dawgs-meeting
tag to a forum topic to bring it up at the next meeting.
Thanks @gardar - you bring up interesting points. Can you open a forum topic on this so it gets wider community discussion, and then add the link to that topic here?
Thanks @gardar - you bring up interesting points. Can you open a forum topic on this so it gets wider community discussion, and then add the link to that topic here?
Sure thing, opened a discussion here: https://forum.ansible.com/t/role-names-in-collections-should-be-able-to-begin-with-a-underscore/10454
Traced this down to the initial commit for the collection structure docs https://github.com/ansible/ansible-documentation/commit/49983fdaf78c3ac286f6155e4eb91d5cb0e2af8f, but I don't see any reasoning behind it. Perhaps this was an issue with the old galaxy and not valid anymore?
@samccann If you need a decision by ansible-core, you could add it to our triage queue by adding the techreview label.
Thanks @s-hertel ! added the label. For core folks - we'd want approval that role names can begin with an underscore (either here in github land or over in the forum post). Thanks!
As the original author of a lot of the collections guts in core, I'm not aware of any technical limitations to underscore-prefixing any component of an FQCN. IIRC the first implementation used the same validation rules for all components out of sheer laziness on my part, which may have contributed to the origin of the rule.
I don't think we want to allow _
prefixed collection namespaces/names, but I personally have no objection to fully supporting _
-prefixed collection resources at any level, as long as there are no associated runtime behavior expectations. The 1.x convention where a _
prefix was a transparent marker for deprecated modules was a bit of a nightmare to unwind, and caused a lot of performance and precedence problems during plugin resolution.
I don't think we want to allow
_
prefixed collection namespaces/names
(and I realize I'm saying this not weeks after creating an internal core collection name starting with _
:roll_eyes: )
Summary
According to the
Collection structure
chapter of the docs:However, I've observed that role names can start with an underscore
_
character without causing any issues. I have tried this with Ansible versions 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2,15, 2.16 and 2.17, and none of them had problems consuming a role with such a name. Ansible Galaxy also imports the role without any issues.I understand that a role name like this might not be aesthetically pleasing, but there is a good reason for it. We recently added an Ansible role for common shared tasks to the [prometheus ansible collection](https://github.com/prometheus-community/ansible). The role is named
_common
(fqcnprometheus.prometheus._common
) to distinguish it from the other roles in the collection, as it is an internal role that's only supposed to be used by the other roles and not directly by a user.Related: https://github.com/ansible/ansible-lint/issues/4370
Issue Type
Bug Report
Component Name
core
Ansible Version
Configuration
OS / Environment
N/A
Steps to Reproduce
N/A
Expected Results
N/A
Actual Results
Code of Conduct