Skip to content
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

php-versions role name was just changed again #2622

Closed
geerlingguy opened this issue Feb 22, 2021 · 7 comments · Fixed by #2626
Closed

php-versions role name was just changed again #2622

geerlingguy opened this issue Feb 22, 2021 · 7 comments · Fixed by #2626
Assignees

Comments

@geerlingguy
Copy link
Contributor

Bug Report

SUMMARY

I'm trying to update my role so it works with ansible-lint 5.x, and that version requires standalone roles to have a valid role_name in the meta/main.yml file.

So I added that value to my php-versions role (which was here: https://galaxy.ansible.com/geerlingguy/php-versions), and imported it on Galaxy.

I saw in the import task output:

Updating repository name "php-versions" -> "php_versions" 

And indeed, the role has vanished from the old URL and is not installable when requiring geerlingguy.php-versions anymore.

I guess I'll have to figure out some workaround to get ansible-lint working, but in the mean time, do you know if the ability to set a role_name in the meta/main.yml file and it not blow out the old name be fixed, or should I just not use that feature and try to work with the ansible-lint maintainer to figure out some other way of supporting standalone Galaxy roles?

The role has a quarter-million downloads and is used by thousands of developers in the PHP ecosystem... I really don't want to break their workflows for too long.

STEPS TO REPRODUCE
  1. Have a role on Ansible Galaxy with a dash in the name.
  2. Set the name of the role in meta/main.yml
  3. Import the role.
EXPECTED RESULTS

The role should not change names replacing dashes with underscores.

ACTUAL RESULTS

The old role is wiped out and moved to an entirely new name, and ansible-galaxy installs for the old role name completely fail (without even a redirect to the new role name).

Related: #2393

@awcrosby awcrosby self-assigned this Feb 23, 2021
@newswangerd
Copy link
Member

@geerlingguy @awcrosby is working on a fix for this today.

@awcrosby
Copy link
Contributor

If a user imports a new standalone role, we want to enforce the usage of underscores not dashes in the role name, so it is easier to move that role to a collection. We also want to support a user’s ability to change a role name by setting the meta/main.yml role_name https://galaxy.ansible.com/docs/contributing/importing.html#role-name-limitations:

To override the default name for an Ansible role, set the role_name attribute in the role meta/main.yml file

But for this particular issue… we shouldn’t break existing roles. So we are planning to add a new logic check to prevent this for existing roles.

Regarding ansible-lint requiring the meta/main.yml role_name, we may want to reconsider that since we state in docs to set it to override the default role name.

@geerlingguy
Copy link
Contributor Author

@awcrosby - Thank you! That would be a huge help, and for ansible-lint, the main difficulty was that unlike with collections, roles don't have any required metadata which could make ansible-lint know what the role's namespace + name should be, so the compromise was to try to use the author + role_name from meta/main.yml. That's not a perfect solution but may help a number of existing role authors (like me ;) who have one of the tens of thousands of roles still maintained on Galaxy today.

@awcrosby
Copy link
Contributor

@geerlingguy a database change has updated "php_versions" -> "php-versions" - so the page and installs should function. We'll let you know when it is safe to import again with the meta/main.yml role_name present.

awcrosby added a commit that referenced this issue Mar 2, 2021
* Have RoleLoader return metadata role_name without any edits
* Validate metadata role_name when it does not match database role name

Resolves: #2622
JIRA tracker issue: AAH-388
@awcrosby
Copy link
Contributor

awcrosby commented Mar 2, 2021

Re-opening this until fix is deployed to production

@awcrosby awcrosby reopened this Mar 2, 2021
@awcrosby
Copy link
Contributor

awcrosby commented Mar 8, 2021

@geerlingguy this fix has been deployed to production, I kicked off an import of php-versions and it was happy with the role_name being set

@awcrosby awcrosby closed this as completed Mar 8, 2021
@geerlingguy
Copy link
Contributor Author

geerlingguy commented Mar 8, 2021

@awcrosby - Woohoo, thanks! I'll test it out on another role too :)

Edit: Worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants