Galaxy: Collections: role has invalid name

Created on 7 Jun 2019  路  7Comments  路  Source: ansible/galaxy

Bug Report

SUMMARY

An error message show when importing a collection:

Error Message: role has invalid name: 'robertdebock.molecule', expecting name to contain only lowercase alphanumeric characters or '_'

I'm not certain if the import checks requirements.yml or the actually installed roles.

Having a period in seems like a valid case.

STEPS TO REPRODUCE
  1. Checkout the git repo.
  2. Run mazer build
  3. Import using the websites "upload" button"

You can also see the results here:
https://galaxy.ansible.com/my-imports/4003?type=collection

EXPECTED RESULTS

The collection would be available.

ACTUAL RESULTS

See error above.

Cool that collections are now available guys!

arebackend prioritlow statunew typbug

All 7 comments

@robertdebock do you have a link to the collection code that I can look at?

That's a valid error coming from the importer. Content items (e.g. roles) must have Python compatible names.

There may be some confusion regarding how to reference the molecule role in an Ansible Playbook. There's an example here that might help: https://galaxy.ansible.com/docs/mazer/examples.html#using-collections-in-playbooks

Oh, for some reason my brain read module name as molecule not robertdebock.molecule

Cool, renamed the roles from robertdebock.{{ role_name }} to {{ role_name }}. Works.

Hm, some roles include other roles.

In this example the role lives in Galaxy in the traditional way of publishing a role, under `robertdebock.{{ role_name }}.
The role is also used in the collection, where I'd need to call the role using a different name. That would mean I'd have to use two different version of the same role.

@robertdebock I think if a role included in a collection depends on another role, it should also be included in the collection or in a second collection listed as a dependency. Collection dependencies have to be other collections, not via old-style Role content on Galaxy.

@ironfroggy okay, did not think of that, good suggestion.

Here is a situation that I can't solve:

I've got roles that depend on other roles. So the repository of role contains meta/main.yml:

# Many items omitted
dependencies:
  - robertdebock.role_a

Using ansible-galaxy install -r roles/requirements.yml will download listed roles in requirements.yml _and their dependencies_ listed meta/main.yml. Which contain{{ namespace }}.{{ role_name }}`.

You can see the behaviour in this ansible_collection_rundeck. The role robertdebock.common depends on robertdebock.reboot.

Hope this help clarify the situation a bit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dallinb picture dallinb  路  5Comments

gustavomcarmo picture gustavomcarmo  路  7Comments

TheRojam picture TheRojam  路  4Comments

robertdebock picture robertdebock  路  6Comments

chouseknecht picture chouseknecht  路  6Comments