# Namespaces and remotes are messed up since the update

**URL:** <https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195>\
**Category:** Get Help\
**Tags:** galaxy-ng\
**Created:** [November 7, 2023, 11:07am UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195 "2023-11-07T11:07:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bviktor](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bviktor](https://forum.ansible.com/u/bviktor)\
**Post date:** [November 7, 2023, 11:07am UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/1 "2023-11-07T11:07:27Z")

</div>

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/](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/](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?

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 7, 2023, 6:21pm UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/2 "2023-11-07T18:21:05Z")

</div>

[noobient](https://galaxy.ansible.com/ui/standalone/namespaces/1066/) is now bound to [bvikor](https://galaxy.ansible.com/ui/namespaces/bviktor/?tab=access) 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](https://ansible.readthedocs.io/projects/galaxy-ng/en/latest/community/userguide/#http-client)

---

<div class="post-metadata">

**Author:** ![bviktor](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bviktor](https://forum.ansible.com/u/bviktor)\
**Post date:** [November 7, 2023, 7:09pm UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/3 "2023-11-07T19:09:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bviktor](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bviktor](https://forum.ansible.com/u/bviktor)\
**Post date:** [November 7, 2023, 11:17pm UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/4 "2023-11-07T23:17:28Z")

</div>

So uh, couple of issues.

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

```auto
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:

```auto
$ 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:

```auto
$ 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:

[https://github.com/ansible/galaxy/issues/2438](https://github.com/ansible/galaxy/issues/2438)

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…

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 8, 2023, 12:27am UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/5 "2023-11-08T00:27:04Z")

</div>

```auto
  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 …

> <https://github.com/ansible/galaxy-importer/blob/master/galaxy_importer/loaders/legacy_role.py#L94-L101>

> <https://github.com/ansible/galaxy-importer/blob/master/galaxy_importer/utils/markup.py#L46-L54>

> <https://github.com/ansible/galaxy-importer/blob/master/galaxy_importer/utils/markup.py#L78-L87>

> <https://github.com/ansible/galaxy-importer/blob/master/galaxy_importer/utils/markup.py#L27-L30>

So the importer code is looking for `README.md` and only `README.md`. The [role’s repository](https://github.com/noobient/ansible-galaxy-logrotate) contains `readme.md`. To fix the error, rename `readme.md` to `README.md`.

---

<div class="post-metadata">

**Author:** ![bviktor](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bviktor](https://forum.ansible.com/u/bviktor)\
**Post date:** [November 8, 2023, 6:36pm UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/6 "2023-11-08T18:36:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 9, 2023, 2:59am UTC](https://forum.ansible.com/t/namespaces-and-remotes-are-messed-up-since-the-update/2195/7 "2023-11-09T02:59:47Z")

</div>

> - `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.

> <https://github.com/ansible/galaxy_ng/blob/master/galaxy_ng/app/api/v1/tasks.py#L423-L425>

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

```auto
"==== 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 …

> <https://github.com/ansible/galaxy-importer/blob/master/galaxy_importer/loaders/legacy_role.py#L79-L92>

I can verify this locally by running galaxy-importer against commit ee12618769e98cea1ec81afed1b08dc98ca54af0 of [GitHub - bviktor/galaxy-placeholder-acme](https://github.com/bviktor/galaxy-placeholder-acme/) …

```auto
    "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 …

```auto
    "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](https://issues.redhat.com/browse/AAH-2843)
