Namespaces and remotes are messed up since the update

Hi,

So my GitHub account is “bviktor”, but I pushed my repos under the “noobient” organization.

When I started using Galaxy, it decided that my namespace will be “bviktor”, and I can’t change it, period. Fine.

Now since the NG update, it’s all a mishmash. I see a bviktor namespace with 23 roles imported:

https://galaxy.ansible.com/ui/standalone/namespaces/8610/

Then there’s also a noobient namespace with 6 roles (???):

https://galaxy.ansible.com/ui/standalone/namespaces/1066/

There’s an overlap between the two, all of the noobient roles are also found under bviktor.

BUT the 6 roles that are ALSO under noobient have a broken repo URL in the bviktor namespace, breaking all my playbooks. E.g. the “logrotate” role. I’d give you links, but apparently “new users are only allowed to post 2 links”, because reasons.

On top of that, the bviktor namespace appears to be owned by me (I see some “Ansible Lightspeed Settings”, but nothing about adding or fetching roles), but the noobient one isn’t even so. It’s stuck in limbo, owned by no one.

So I have no idea what happened but I’d really like to fix these, because I’m unable to use OR manage my roles as of now.

TLDR: can you please grant me ownership to the noobient namespace, and also any resources how I’m supposed to add new roles to them and update existing ones, especially remote URLs that have been broken since the update to NG?

noobient is now bound to bvikor so you should have full control over it.

The roles in noobient are a side effect of bad sync code that we have since corrected. If you’d like to delete them, please use the instructions provided here

1 Like

Thanks a lot, I’ll have a look and report back.

So uh, couple of issues.

First off, the docs talk about beta endpoints. Those endpoints give me this:

ERROR! None (HTTP Code: 307, Message: Temporary Redirect)

So I falled back to https://galaxy.ansible.com/api/. it might also be worth adding a note that one should most likely put their token in ~/.ansible.cfg, not in under /etc, or even worse, in the repo root.

Then I tried an import, and it fails:

$ ansible-galaxy role import noobient ansible-galaxy-logrotate
Successfully submitted import request 2054447221603017279459396803068401469
running
No role readme found
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 370, in legacy_role_import
    result = import_legacy_role(checkout_path, namespace.name, importer_config, logger)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 51, in import_legacy_role
    return _import_legacy_role(dirname, namespace, cfg, logger)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 57, in _import_legacy_role
    data = LegacyRoleLoader(dirname, namespace, cfg, logger).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 43, in load
    self.readme = self._load_readme()
                  ^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 99, in _load_readme
    raise exc.ImporterError("No role readme found")

I think I’m on the latest of everything, just ran the update before doing all this:

$ pip list | grep ansible
ansible                   8.6.0
ansible-compat            4.1.10
ansible-core              2.15.6
ansible-lint              6.22.0

There seems to be a related bug:

And that’s about it. As I’m publishing roles, not collections, I don’t even have a “roles” folder. Not to mention that according to the bug report, not even the collection workaround works anymore.

So that’s where I’m stuck as of now. In any case, I do have a readme.md in all my role roots…

  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 99, in _load_readme
    raise exc.ImporterError("No role readme found")

This comes from this section of galaxy-importer …

So the importer code is looking for README.md and only README.md. The role’s repository contains readme.md. To fix the error, rename readme.md to README.md.

Alright, I’ll rename all my readmes then…

In any case, 2 more issues:

  • ansible-galaxy role import simply ignores the --role-name argument
  • The ansible-role- prefix is not automatically trimmed either, even though the doc claims so.
  • Because of that, I have some badly names roles now. But trying to delete roles using ansible-galaxy role delete gives an ERROR! None (HTTP Code: 500, Message: Internal Server Error)

Does anyone ever test these? Sorry if I’m rude, and I know you’re trying to help, but there’s pretty much no step in this process that’s not broken one way or another. Excruciating.

  • ansible-galaxy role import simply ignores the --role-name argument

It wasn’t completely ignored, but there is a logic bug in the import code which assumed galaxy-importer was going to return a null name if not defined in meta/main.yml and then would have used the supplied alternate-role-name.

I see in the logs for your first import that it set the final name to ansible-galaxy-namespace …

"==== PARAMETERS ===="
"importer username: bviktor"
"matched user: bviktor id:1078"
"github_user: bviktor"
"github_repo: ansible-galaxy-namespace"
"github_reference: None"
"alternate_role_name: acme"

"===== PROCESSING LOADER RESULTS ===="
"enumerated role name ansible-galaxy-namespace"
"created new role id:37292 bviktor.ansible-galaxy-namespace"

The reason it ended up with that is because galaxy-importer used the checkout path to make up the name …

I can verify this locally by running galaxy-importer against commit ee12618769e98cea1ec81afed1b08dc98ca54af0 of GitHub - bviktor/galaxy-placeholder-acme

    "name": "galaxy-placeholder-acme",
    "metadata": {
        "galaxy_info": {
            "role_name": null,
            "namespace": null,
            "author": "Viktor Berke",
            "description": "Switch namespace from bviktor to noobient",
            "company": null,
            "issue_tracker_url": null,
            "license": "license (MIT)",
            "min_ansible_version": "2.10",
            "min_ansible_container_version": null,
            "github_branch": null,
            "platforms": [], 
            "galaxy_tags": []
        },
        "dependencies": []
    },  

With the most recent commit of the repo, we get the right name because it’s been set in meta/main.yml …

    "name": "acme",
    "metadata": {
        "galaxy_info": {
            "role_name": "acme",
            "namespace": null,
            "author": "Viktor Berke",
            "description": "Switch namespace from bviktor to noobient",
            "company": null,
            "issue_tracker_url": null,
            "license": "license (MIT)",
            "min_ansible_version": "2.10",
            "min_ansible_container_version": null,
            "github_branch": null,
            "platforms": [], 
            "galaxy_tags": []
        },
        "dependencies": []
    }, 

I think what we need to do is change the line in the import code to use the metadata.galaxy_info.role_name property as the first choice instead of .name.

I’ve opened a bug to capture this and will try to get it fixed soon.

https://issues.redhat.com/browse/AAH-2843