[Pulp-list] rpm publication problem pulp3

Dennis Kliban dkliban at redhat.com
Tue Jun 18 14:07:16 UTC 2019


On Tue, Jun 18, 2019 at 9:05 AM Juan Cabrera <juan.cabrera at unamur.be> wrote:

> Hi all,
>
> Until now I was using the "One shot upload" to upload the packages.
>
> If I understand correctly, with "One shot upload" it is not possible to
> add the same package to a different repository as a rise condition is set:
>  if not created:
>
>         raise OSError('RPM package {} already
> exists.'.format(pkg.filename))
>

This makes sense. Once an RPM is in Pulp, you should use the Repository
Version Create API[0] to add it to another repository.

[0]
https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_create


> So I try the long way. In this case I can upload the packages (artifacts)
> and create contents but there is a problem when I what to create a
> publication.
>
Please file an issue about this problem[1]. You should not be able to
create a duplicate RPM package. It looks like Pulp 3 is not validating that
all required fields are being supplied to the RPM create API[1].

[1] https://pulp.plan.io/projects/pulp_rpm/issues/new
[2]
https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_packages_create



> {
>     "_created": "2019-06-18T12:26:28.001989Z",
>     "_href": "/pulp/api/v3/tasks/76fe1068-450d-43b2-b550-b224f7acad74/",
>     "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)=(36599dd4-2698-4eb8-8362-12b391d9739a,
> ) already exists.\n",
>         "traceback": "  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py\", line
> 812, in perform_job\n    rv = job.perform()\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 588,
> in perform\n    self._result = self._execute()\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 594,
> 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 100, in publish\n    populate(publication)\n  File
> \"/usr/local/lib/pulp/lib64/python3.6/site-packages/pulp_rpm/app/tasks/publishing.py\",
> line 213, 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-06-18T12:26:28.092046Z",
>     "name": "pulp_rpm.app.tasks.publishing.publish",
>     "non_fatal_errors": [],
>     "parent": null,
>     "progress_reports": [],
>     "spawned_tasks": [],
>     "started_at": "2019-06-18T12:26:28.053503Z",
>     "state": "failed",
>     "worker": "/pulp/api/v3/workers/922cc43e-5f7b-4d08-b44a-2ce61105dab3/"
> }
>
> I join the functional tests I did. The 'test-short.sh' works fine but the
> 'test-long.sh' gives the previous error.
>
> Before running the script, I delete all the repositories, packages,
> publications, and distributions in the server. I do not understand the
> publication_id problem
>
> Key (publication_id, relative_path)=(36599dd4-2698-4eb8-8362-12b391d9739a,
> ) already exists
>
> As usual I'm using this version to create the pulp server:
>
> pulp_source_dir: "git+https://github.com/pulp/pulpcore.git@3.0.0rc2"
> <git+https://github.com/pulp/pulpcore.git@3.0.0rc2>
> pulp_plugin_source_dir:
> "git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc2"
> <git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc2>
>
> pulp_install_plugins:
>   pulp-rpm:
>     app_label: "rpm"
>     source_dir: "git+https://github.com/pulp/pulp_rpm.git@3.0.0b3"
> <git+https://github.com/pulp/pulp_rpm.git@3.0.0b3>
>
> Can somebody help me on this ?
>
> Regards
>
> 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/20190618/997cd670/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oimbindofdbdnmho.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190618/997cd670/attachment.png>


More information about the Pulp-list mailing list