Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uprole_skeleton read by ansible-galaxy collection init #66255
Comments
|
Files identified in the description: If these files are inaccurate, please update the |
|
On the surface this is an easy fix, but I'm unsure what else may need to change as a result of this: diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py
index 89a9dcc547..94f312c1b4 100644
--- a/lib/ansible/cli/galaxy.py
+++ b/lib/ansible/cli/galaxy.py
@@ -217,7 +217,7 @@ class GalaxyCLI(CLI):
help='The path in which the skeleton {0} will be created. The default is the '
'current working directory.'.format(galaxy_type))
init_parser.add_argument('--{0}-skeleton'.format(galaxy_type), dest='{0}_skeleton'.format(galaxy_type),
- default=C.GALAXY_ROLE_SKELETON,
+ default=C.GALAXY_ROLE_SKELETON if galaxy_type == 'role' else None,
help='The path to a {0} skeleton that the new {0} should be based '
'upon.'.format(galaxy_type))Does the underlying collection code handle More testing, and a changelog would be required. I'm not pursuing this further at this time. |
|
The other question would be—do we eventually want to support custom collection skeletons? That would be a separate feature request, but I know enough people have found role skeletons to be a huge productivity booster, that I would imagine custom collection skeletons would be the same. (I didn't realize this didn't exist yet.) |
Since we have a default collection skeleton, and we support custom role skeletons, I can't image we wouldn't want to support custom collection skeletons. I don't plan to make as many collections as I have roles - that's one of the things I like about collections. But I do plan to make at least one for each product we support and would love to have skeleton support. |
|
To further clarify, this is only an issue for users who have explicitly configured GALAXY_ROLE_SKELETON |
|
@sivel - I also noticed in the docs it mentions:
(Emphasis mine) So if this is fixed that docs line also needs updating since the variable would no longer apply to collections. So I guess the bug is that right now the variable name is misleading, and there's only one variable used for two different types of content, which makes the experience broken if you already it use roles and want to start creating collections. |


SUMMARY
When executing
ansible-galaxy collection initwith a value in galaxy.role_skeleton inside of ansible.cfg, the role skeleton directory is read to create a new collection. Based on its name, therole_skeletonvalue should not apply to a collection init call.ISSUE TYPE
COMPONENT NAME
ansible-galaxy
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
All
STEPS TO REPRODUCE
EXPECTED RESULTS
Creates a collection directory based on the default collection skeleton
ACTUAL RESULTS
Templates the custom skeleton directory defined by GALAXY_ROLE_SKELETON exactly as if
ansible-galaxy init myrolehad been called, but with an empty value forrole_name. Files are contained within the propermynamespace/mycollectionfolder depth, though, as expected. However, they are the role skeleton files instead of the collection skeleton.