[Pulp-list] publication creation do not work for non sync repos.

Dennis Kliban dkliban at redhat.com
Thu May 16 16:32:08 UTC 2019


On Thu, May 16, 2019 at 10:47 AM Juan Cabrera <juan.cabrera at unamur.be>
wrote:

> Hi again,
>
> I made a script for the work flow: create repo - create remote -
> synchronize - create publisher - create publication - create distribution,
> that works well.
>
> Now I try using a repo with local rpm. I can not create a publication I
> get duplicate key value violates unique constraint
>
> I use this versions:
>
> pulp_source_dir: "git+https://github.com/pulp/pulpcore.git@3.0.0rc1"
> <git+https://github.com/pulp/pulpcore.git@3.0.0rc1>
> pulp_plugin_source_dir:
> "git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc1"
> <git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc1>
> pulp_install_plugins:
>   pulp-rpm:
>     app_label: "rpm"
>     source_dir: "git+https://github.com/pulp/pulp_rpm.git@3.0.0b2"
> <git+https://github.com/pulp/pulp_rpm.git@3.0.0b2>
>
> This is what I do:
>
> sudo yum install yum-utils
> PORT=:24817
> # get somme rpm
> yumdownloader --resolve --destdir=mypackages/ httpd
> # create a repo
> export REPO_HREF=$(http POST $PORT/pulp/api/v3/repositories/
> name=local_repo | jq -r '._href')
>
> # add rpm packages
> for p in `ls mypackages`; do
>   export ARTIFACT_REF=$(http --form POST $PORT/pulp/api/v3/artifacts/
> file at ./mypackages/$p | jq -r '._href')
>   export CONTENT_HREF=$(http POST $PORT/pulp/api/v3/content/rpm/packages/
> _artifact="$ARTIFACT_REF" filename="$p" | jq -r '._href')
>
You need to specify 'relative_path' when creating an rpm package content
unit. This should be the file name. Our REST API docs[0] don't specify that
this is requiered, but it is. I'll file an issue.

[0]
https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_packages_create


>   http POST $PORT${REPO_HREF}versions/
> add_content_units:="[\"$CONTENT_HREF\"]"
> done
>
> # Create publisher
> export PUBLISHER_HREF=$(http POST $PORT/pulp/api/v3/publishers/rpm/rpm/
> name=ptci | jq -r '._href')
> # Create publication
> export TASK=$(http POST $PORT${PUBLISHER_HREF}publish/
> repository=$REPO_HREF | jq -r '.task')
>
> http $PORT$TASK
>
> HTTP/1.1 200 OK
> Allow: GET, DELETE, HEAD, OPTIONS
> Connection: close
> Content-Length: 3416
> Content-Type: application/json
> Date: Thu, 16 May 2019 14:30:27 GMT
> Server: gunicorn/19.9.0
> Vary: Accept, Cookie
> X-Frame-Options: SAMEORIGIN
>
> {
>     "_created": "2019-05-16T14:15:55.721616Z",
>     "_href": "/pulp/api/v3/tasks/799ba82c-b289-4054-aca3-2c35eab208ff/",
>     "created_resources": [],
>     "error": {
>         "code": null,
>         "description": "*duplicate key value violates unique constraint*
> \"core_publishedartifact_publication_id_relative__97f785f4_uniq\"\nDETAIL:
> Key (publication_id, relative_path)=(f76de19c-22a6-485f-93bd-3e3578de9405,
> ) already exists.\n",
>         "traceback": "  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py\", line
> 799, in perform_job\n    rv = job.perform()\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 600,
> in perform\n    self._result = self._execute()\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 606,
> in _execute\n    return self.func(*self.args, **self.kwargs)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/pulp_rpm/app/tasks/publishing.py\",
> line 104, in publish\n    populate(publication)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/pulp_rpm/app/tasks/publishing.py\",
> line 217, in populate\n    published_artifact.save()\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py\",
> line 741, in save\n    force_update=force_update,
> update_fields=update_fields)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py\",
> line 779, in save_base\n    force_update, using, update_fields,\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py\",
> line 870, in _save_table\n    result = self._do_insert(cls._base_manager,
> using, fields, update_pk, raw)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py\",
> line 908, in _do_insert\n    using=using, raw=raw)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/manager.py\",
> line 82, in manager_method\n    return getattr(self.get_queryset(),
> name)(*args, **kwargs)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py\",
> line 1186, in _insert\n    return
> query.get_compiler(using=using).execute_sql(return_id)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py\",
> line 1335, in execute_sql\n    cursor.execute(sql, params)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py\",
> line 67, in execute\n    return self._execute_with_wrappers(sql, params,
> many=False, executor=self._execute)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py\",
> line 76, in _execute_with_wrappers\n    return executor(sql, params, many,
> context)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py\",
> line 84, in _execute\n    return self.cursor.execute(sql, params)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/utils.py\",
> line 89, in __exit__\n    raise dj_exc_value.with_traceback(traceback) from
> exc_value\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py\",
> line 84, in _execute\n    return self.cursor.execute(sql, params)\n"
>     },
>     "finished_at": "2019-05-16T14:15:55.807566Z",
>     "name": "pulp_rpm.app.tasks.publishing.publish",
>     "non_fatal_errors": [],
>     "parent": null,
>     "progress_reports": [],
>     "spawned_tasks": [],
>     "started_at": "2019-05-16T14:15:55.773242Z",
>     "state": "failed",
>     "worker": "/pulp/api/v3/workers/a9f1e265-fd17-467b-afd5-58af626dab1d/"
> }
>
> I do not know were this duplicate key comes. I use a clean Vagran VM. And
> there is no publications
>
>
> http $PORT/pulp/api/v3/publications/
>
> HTTP/1.1 200 OK
> Allow: GET, HEAD, OPTIONS
> Connection: close
> Content-Length: 52
> Content-Type: application/json
> Date: Thu, 16 May 2019 14:42:40 GMT
> Server: gunicorn/19.9.0
> Vary: Accept, Cookie
> X-Frame-Options: SAMEORIGIN
>
> {
>     "count": 0,
>     "next": null,
>     "previous": null,
>     "results": []
> }
>
> I did something wrong ?
>
> Juan
>
> --
>
> Juan CABRERA
> Correspondant informatique
> Département de Mathématiques
>
> T. 081724919
> juan.cabrera at unamur.be
> http://staff.unamur.be/jbcabrer
>
> Université de Namur ASBL
> Rue de Bruxelles 61 - 5000 Namur
> Belgique
>
> Let’s respect the environment together.
> Only print this message if necessary!
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190516/a24ce861/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pecmppofeooimcnj.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190516/a24ce861/attachment.png>


More information about the Pulp-list mailing list