Pulp ansible repo sync gives 'ClientResponseError' object has no attribute 'path'

Hello,

I have 2 Pulp hosts one should be syncing ansible collections from another.

I’ve followed the steps:
https://pulpproject.org/pulp_ansible/docs/user/guides/collections/

but getting the following error:

# pulp -v ansible repository sync --name "foo" --remote "cbar"

repositories_ansible_ansible_list : get https://localhost/pulp/api/v3/repositories/ansible/ansible/?name=foo&offset=0&limit=1

Response: 200

remotes_ansible_collection_list : get https://localhost/pulp/api/v3/remotes/ansible/collection/?name=cbar&offset=0&limit=1

Response: 200

repositories_ansible_ansible_sync : post https://localhost/pulp/api/v3/repositories/ansible/ansible/01931ada-a94d-7cf3-af58-4c2edbfcf9da/sync/

Response: 202

tasks_read : get https://localhost/pulp/api/v3/tasks/01931ae1-2f3b-741a-be21-9a4bbe65de29/

Response: 200

Started background task /pulp/api/v3/tasks/01931ae1-2f3b-741a-be21-9a4bbe65de29/

Error: Task /pulp/api/v3/tasks/01931ae1-2f3b-741a-be21-9a4bbe65de29/ failed: ''ClientResponseError' object has no attribute 'path''

Logs from the myhost1:

pulp [0e58c2f8ee534822bd8e54be142b4d6a]: django.request:WARNING: Not Found: /pulp_ansible/galaxy/foo/
('pulp [0e58c2f8ee534822bd8e54be142b4d6a]: ::ffff:127.0.0.1 - - [11/Nov/2024:11:38:18 +0000] "GET /pulp_ansible/galaxy/foo/ HTTP/1.0" 404 179 "-" "pulpcore/3.66.0 (cpython 3.9.20-final0, Linux x86_64) (aiohttp 3.10.10)"',)
('pulp [be6830f8cf934931af8d67cd5c323151]: ::ffff:127.0.0.1 - - [11/Nov/2024:11:38:18 +0000] "GET /pulp_ansible/galaxy/foo/api/ HTTP/1.0" 200 69 "-" "pulpcore/3.66.0 (cpython 3.9.20-final0, Linux x86_64) (aiohttp 3.10.10)"',)
pulp [e278922f22e2424c902cf410dd698fc8]: django.request:WARNING: Not Found: /pulp_ansible/galaxy/foo/api/v3/excludes/
('pulp [e278922f22e2424c902cf410dd698fc8]: ::ffff:127.0.0.1 - - [11/Nov/2024:11:38:18 +0000] "GET /pulp_ansible/galaxy/foo/api/v3/excludes/ HTTP/1.0" 404 179 "-" "pulpcore/3.66.0 (cpython 3.9.20-final0, Linux x86_64) (aiohttp 3.10.10)"',)
pulp [16df12d52c204e148dbafd3403f0f3ac]: django.request:WARNING: Unauthorized: /pulp_ansible/galaxy/foo/api/v3/collections/all/
('pulp [16df12d52c204e148dbafd3403f0f3ac]: ::ffff:127.0.0.1 - - [11/Nov/2024:11:38:18 +0000] "GET /pulp_ansible/galaxy/foo/api/v3/collections/all/ HTTP/1.0" 401 112 "-" "pulpcore/3.66.0 (cpython 3.9.20-final0, Linux x86_64) (aiohttp 3.10.10)"',)

My ansible remote on host myhost2 looks like this:

[

  {

    "pulp_href": "/pulp/api/v3/remotes/ansible/collection/01931adf-7da1-7bb8-9138-4f71ef92a030/",

    "prn": "prn:ansible.collectionremote:01931adf-7da1-7bb8-9138-4f71ef92a030",

    "pulp_created": "2024-11-11T10:57:54.595062Z",

    "pulp_last_updated": "2024-11-11T10:59:32.970604Z",

    "name": "cbar",

    "url": "https://myhost1.test.test/pulp_ansible/galaxy/foo/",

    "ca_cert": null,

    "client_cert": null,

    "tls_validation": false,

    "proxy_url": null,

    "pulp_labels": {},

    "download_concurrency": null,

    "max_retries": null,

    "policy": "immediate",

    "total_timeout": null,

    "connect_timeout": null,

    "sock_connect_timeout": null,

    "sock_read_timeout": null,

    "headers": null,

    "rate_limit": null,

    "hidden_fields": [

      {

        "name": "client_key",

        "is_set": false

      },

      {

        "name": "proxy_username",

        "is_set": false

      },

      {

        "name": "proxy_password",

        "is_set": false

      },

      {

        "name": "username",

        "is_set": false

      },

      {

        "name": "password",

        "is_set": false

      },

      {

        "name": "token",

        "is_set": false

      }

    ],

    "requirements_file": null,

    "auth_url": null,

    "sync_dependencies": true,

    "signed_only": false,

    "last_sync_task": {

      "pk": "01931b04-7a33-7b9b-a681-f0e7fa5522a4",

      "error": {

        "traceback": "  File \"/usr/local/lib/python3.9/site-packages/pulpcore/tasking/tasks.py\", line 68, in _execute_task\n    result = func(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pulp_ansible/app/tasks/collections.py\", line 192, in sync\n    repo_version = d_version.create()\n  File \"/usr/local/lib/python3.9/site-packages/pulpcore/plugin/stages/declarative_version.py\", line 161, in create\n    loop.run_until_complete(pipeline)\n  File \"/usr/lib64/python3.9/asyncio/base_events.py\", line 647, in run_until_complete\n    return future.result()\n  File \"/usr/local/lib/python3.9/site-packages/pulpcore/plugin/stages/api.py\", line 220, in create_pipeline\n    await asyncio.gather(*futures)\n  File \"/usr/local/lib/python3.9/site-packages/pulpcore/plugin/stages/api.py\", line 41, in __call__\n    await self.run()\n  File \"/usr/local/lib/python3.9/site-packages/pulp_ansible/app/tasks/collections.py\", line 1051, in run\n    await self._download_unpaginated_metadata()\n  File \"/usr/local/lib/python3.9/site-packages/pulp_ansible/app/tasks/collections.py\", line 902, in _download_unpaginated_metadata\n    collection_metadata_list = parse_metadata(col_results)\n  File \"/usr/local/lib/python3.9/site-packages/pulp_ansible/app/tasks/utils.py\", line 97, in parse_metadata\n    with open(download_result.path) as fd:\n",

        "description": "'ClientResponseError' object has no attribute 'path'"

      },

      "state": "failed",

      "finished_at": "2024-11-11T11:38:18.862418+00:00",

      "pulp_created": "2024-11-11T11:38:18.548519+00:00"

    }

  }

]

My ansible repo and distribution on host myhost1 look as follows:

Repository

 {

    "pulp_href": "/pulp/api/v3/repositories/ansible/ansible/01931aca-6378-7e22-a873-b195588388ff/",

    "prn": "prn:ansible.ansiblerepository:01931aca-6378-7e22-a873-b195588388ff",

    "pulp_created": "2024-11-11T10:34:51.641337Z",

    "pulp_last_updated": "2024-11-11T10:34:51.652839Z",

    "versions_href": "/pulp/api/v3/repositories/ansible/ansible/01931aca-6378-7e22-a873-b195588388ff/versions/",

    "pulp_labels": {},

    "latest_version_href": "/pulp/api/v3/repositories/ansible/ansible/01931aca-6378-7e22-a873-b195588388ff/versions/0/",

    "name": "foo",

    "description": null,

    "retain_repo_versions": null,

    "remote": null,

    "last_synced_metadata_time": null,

    "gpgkey": null,

    "last_sync_task": null,

    "private": false

  }

Distribution

  {

    "pulp_href": "/pulp/api/v3/distributions/ansible/ansible/01931acb-fcc8-7800-aa78-ef5b28897dcb/",

    "pulp_created": "2024-11-11T10:36:36.425648Z",

    "base_path": "foo",

    "content_guard": null,

    "name": "foo",

    "repository": "/pulp/api/v3/repositories/ansible/ansible/01931aca-6378-7e22-a873-b195588388ff/",

    "repository_version": null,

    "client_url": "https://myhost1.test.test/pulp_ansible/galaxy/foo/",

    "pulp_labels": {}

  },

Any hints what could be the issue here? Do I have to set up authentication to make it work?

Thanks

Yes you are going to have to set up authentication on host2’s remote if you want to sync from host1. The logs are showing 401 Unauthorized. You could also disable RBAC auth checks on host1 by setting ANSIBLE_PERMISSION_CLASSES to an empty list.

4 Likes

Thanks a lot gerrod. You made my day!

3 Likes