Project

Profile

Help

Story #5288

closed

As a user, I can sync collections from another Pulp server

Added by sajha over 4 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 58
Quarter:

Description

This is from before the requirements.yaml PR went in..

STEPS TO REPRODUCE:

#Create repo
http POST $BASE_ADDR/pulp/api/v3/repositories/ name=foo
export REPO_HREF=$(http $BASE_ADDR/pulp/api/v3/repositories/ | \
  jq -r '.results[] | select(.name == "foo") | ._href')

#Create remote
http POST $BASE_ADDR/pulp/api/v3/remotes/ansible/collection/     name='bar'     url='https://galaxy-dev.ansible.com/api/v2/collections/testing/ansible_testing_content'
export REMOTE_HREF=$(http $BASE_ADDR/pulp/api/v3/remotes/ansible/collection/ | jq -r '.results[] | select(.name == "bar") | ._href')

#Sync repo with Remote
export TASK_URL=$(http POST $BASE_ADDR$REMOTE_HREF'sync/' repository=$REPO_HREF \
  | jq -r '.task')
export REPOVERSION_HREF=$(http $BASE_ADDR$TASK_URL | jq -r '.created_resources[]')

#Create Distribution for the synced Repo
export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/distributions/ansible/ansible/ \
  name='baz' \
  base_path='foo' \
  repository=${REPO_HREF} | jq -r '.task')
export DIST_PATH=$(http $BASE_ADDR$TASK_URL | jq -r '.created_resources[]')

#Form SYNC_URL
export GALAXY_URL=$(http $BASE_ADDR$DIST_PATH | jq -r '.mazer_url')
export SYNC_URL=$GALAXY_URL'/api/v2/collections/testing/ansible_testing_content'
http $SYNC_URL
# Notice Error in /var/log/messages around multiple collection versions being returned.
http $SYNC_URL'/versions'

#-----------------Try to use $SYNC_URL as remote for 2nd repo----------
#Create 2nd repo to sync from the sync url
export REPO_HREF=$(http $BASE_ADDR/pulp/api/v3/repositories/ | \
  jq -r '.results[] | select(.name == "foo1") | ._href')

#Create remote with url pointing to pulp's galaxy endpoint of 1st repo
http POST $BASE_ADDR/pulp/api/v3/remotes/ansible/collection/     name='bar1'     url=$SYNC_URL
export REMOTE_HREF=$(http $BASE_ADDR/pulp/api/v3/remotes/ansible/collection/ | jq -r '.results[] | select(.name == "bar1") | ._href')

#Notice url in the Remote
http $BASE_HREF$REMOTE_HREF

#Sync repo2 with remote poinitng to 1st repos pulp-galaxy url
export TASK_URL=$(http POST $BASE_ADDR$REMOTE_HREF'sync/' repository=$REPO_HREF \
  | jq -r '.task')
#Notice failure in /var/log/messages
http $BASE_HREF$TASK_URL

#http://localhost:24817/pulp_ansible/galaxy/foo/api/v2/collections/testing/ansible_testing_content/versions/4.0.4/ as sync URL fails too

Tried this with a collection https://galaxy.ansible.com/api/v2/collections/devoperate/base/versions/ having only one version. Got the error:

"error": {
        "code": null,
        "description": "string indices must be integers",
        "traceback": "  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py\", line 822, in perform_job\n    rv = job.perform()\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 605, in perform\n    self._result = self._execute()\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 611, in _execute\n    return self.func(*self.args, **self.kwargs)\n  File \"/usr/local/lib/pulp/src/pulp-ansible/pulp_ansible/app/tasks/collections.py\", line 66, in sync\n    d_version.create()\n  File \"/usr/local/lib/pulp/src/pulpcore-plugin/pulpcore/plugin/stages/declarative_version.py\", line 169, in create\n    loop.run_until_complete(pipeline)\n  File \"/usr/lib64/python3.6/asyncio/base_events.py\", line 484, in run_until_complete\n    return future.result()\n  File \"/usr/local/lib/pulp/src/pulpcore-plugin/pulpcore/plugin/stages/api.py\", line 209, in create_pipeline\n    await asyncio.gather(*futures)\n  File \"/usr/local/lib/pulp/src/pulpcore-plugin/pulpcore/plugin/stages/api.py\", line 43, in __call__\n    await self.run()\n  File \"/usr/local/lib/pulp/src/pulp-ansible/pulp_ansible/app/tasks/collections.py\", line 195, in run\n    async for metadata in self._fetch_collections():\n  File \"/usr/local/lib/pulp/src/pulp-ansible/pulp_ansible/app/tasks/collections.py\", line 242, in _fetch_collections\n    \"namespace\": result[\"namespace\"][\"name\"],\n"
    },

Related issues

Related to Ansible Plugin - Test #5333: As a user, I can sync collections from another Pulp serverCLOSED - COMPLETEkersomActions

Also available in: Atom PDF