galaxy: Installing roles with dashes in the name is broken
Bug Report
SUMMARY
I used to be able to install roles with dashes in the name, e.g. elliotweiser.osx-command-line-tools. I can no longer do so. It appears that underscores are required. This breaks roles and playbooks that pull in such roles as dependencies.
Example: https://travis-ci.org/geerlingguy/mac-dev-playbook/builds/398684539
STEPS TO REPRODUCE
pip install ansible # occurs w/ 2.6 and 2.5
ansible-galaxy install elliotweiser.osx-command-line-tools
EXPECTED RESULTS
The role should be successfully downloaded.
ACTUAL RESULTS
$ ansible-galaxy install elliotweiser.osx-command-line-tools
- downloading role 'osx-command-line-tools', owned by elliotweiser
[WARNING]: - elliotweiser.osx-command-line-tools was NOT installed successfully: - sorry, elliotweiser.osx-command-line-tools was not
found on https://galaxy.ansible.com.
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
It appears the role can only be installed when using underscores instead of dashes:
$ ansible-galaxy install elliotweiser.osx_command_line_tools
- downloading role 'osx_command_line_tools', owned by elliotweiser
- downloading role from https://github.com/elliotweiser/ansible-osx-command-line-tools/archive/2.1.0.tar.gz
- extracting elliotweiser.osx_command_line_tools to /Users/elliotweiser/git/github/elliotweiser/elliotweiser.osx_command_line_tools
- elliotweiser.osx_command_line_tools (2.1.0) was installed successfully
I’m not sure if this was change in behavior was intentional, but it may have been an oversight.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 33 (16 by maintainers)
Commits related to this issue
- Use underscores instead of dashes for dependencies Fixes geerlingguy/mac-dev-playbook#65 Relates to ansible/galaxy#775 — committed to elliotweiser/ansible-role-homebrew by elliotweiser 6 years ago
- s/backups-role/backups_role/g It looks like Ansible Galaxy replaces dashes with underscores. https://github.com/ansible/galaxy/issues/775#issuecomment-403241643 Let's replace all names and examples ... — committed to raneq/backups-role by raneq 5 years ago
@paulfantom
That last one is fixed. It’s now ‘mysqld-exporter’.
Going forward, anything new will have ‘-’ converted to ‘_’.
If you want to alter the name (e.g., remove ‘ansible-’), then use the
role_name
attribute to set the name.Deleting a role and re-importing, or setting the
role_name
value, will update the name in the Galaxy database, and cause ‘-’ to be converted to ‘_’.Some additional irony…
This URL looks good 👍 https://galaxy.ansible.com/elliotweiser/osx-command-line-tools
This one, not so much… https://galaxy.ansible.com/elliotweiser/osx_command_line_tools
What about this?
“Changes to APIs must always be deployed as fully backwards compatible upgrades”
Endpoint stability
@elliotweiser
Fixed by #784. You can test your role at https://galaxy-qa.ansible.com - our QA site, where your role is still named ‘osx-command-line-tools’
The patch will be deployed to production tomorrow morning. Let us know, if you want to rename your role in production.
Closing, as I think we’ve renamed all the roles listed on this issue.
If you find more roles that you want renamed from ‘_’ to ‘-’, please open a new issue, so that we don’t miss it.
Great feature. Congrats.
…
@lae
Your travis-lxc roles is fixed now. As a test, I re-imported after the change, and both the repo and content name remain as ‘travis-lxc’.
@elliotweiser
osx-command-line-tools
is fixed.