<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 18, 2019 at 9:05 AM Juan Cabrera <<a href="mailto:juan.cabrera@unamur.be">juan.cabrera@unamur.be</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF">
    <p>Hi all,</p>
    <p>Until now I was using the "One shot upload" to upload the
      packages.<br>
    </p>
    <p>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:<br>
    </p>
     if not created:<br>
    <p>        raise OSError('RPM package {} already
      exists.'.format(pkg.filename))</p></div></blockquote><div><br></div><div>This makes sense. Once an RPM is in Pulp, you should use the Repository Version Create API[0] to add it to another repository.<br></div><div><br></div><div>[0] <a href="https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_create">https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_create</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <p>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.</p></div></blockquote><div>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].</div><div><br></div><div>[1] <a href="https://pulp.plan.io/projects/pulp_rpm/issues/new">https://pulp.plan.io/projects/pulp_rpm/issues/new</a></div><div>[2] <a href="https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_packages_create">https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_packages_create</a></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <p><tt>{</tt><tt><br>
      </tt><tt>    "_created": "2019-06-18T12:26:28.001989Z", </tt><tt><br>
      </tt><tt>    "_href":
        "/pulp/api/v3/tasks/76fe1068-450d-43b2-b550-b224f7acad74/", </tt><tt><br>
      </tt><tt>    "created_resources": [], </tt><tt><br>
      </tt><tt>    "error": {</tt><tt><br>
      </tt><tt>        "code": null, </tt><tt><br>
      </tt><tt>        "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", </tt><tt><br>
      </tt><tt>        "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"</tt><tt><br>
      </tt><tt>    }, </tt><tt><br>
      </tt><tt>    "finished_at": "2019-06-18T12:26:28.092046Z", </tt><tt><br>
      </tt><tt>    "name": "pulp_rpm.app.tasks.publishing.publish", </tt><tt><br>
      </tt><tt>    "non_fatal_errors": [], </tt><tt><br>
      </tt><tt>    "parent": null, </tt><tt><br>
      </tt><tt>    "progress_reports": [], </tt><tt><br>
      </tt><tt>    "spawned_tasks": [], </tt><tt><br>
      </tt><tt>    "started_at": "2019-06-18T12:26:28.053503Z", </tt><tt><br>
      </tt><tt>    "state": "failed", </tt><tt><br>
      </tt><tt>    "worker":
        "/pulp/api/v3/workers/922cc43e-5f7b-4d08-b44a-2ce61105dab3/"</tt><tt><br>
      </tt><tt>}</tt><br>
    </p>
    <p>I join the functional tests I did. The 'test-short.sh' works fine
      but the 'test-long.sh' gives the previous error.</p>
    <p>Before running the script, I delete all the repositories,
      packages, publications, and distributions in the server. I do not
      understand the publication_id problem<br>
    </p>
    <p><tt>Key (publication_id,
        relative_path)=(36599dd4-2698-4eb8-8362-12b391d9739a, ) already
        exists</tt></p>
    <p>As usual I'm using this version to create the pulp server:</p>
    <p><tt>pulp_source_dir:
        <a class="gmail-m_-2573507517161683878moz-txt-link-rfc2396E" href="mailto:git+https://github.com/pulp/pulpcore.git@3.0.0rc2" target="_blank">"git+https://github.com/pulp/pulpcore.git@3.0.0rc2"</a></tt><tt><br>
      </tt><tt>pulp_plugin_source_dir:
        <a class="gmail-m_-2573507517161683878moz-txt-link-rfc2396E" href="mailto:git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc2" target="_blank">"git+https://github.com/pulp/pulpcore-plugin.git@0.1.0rc2"</a></tt></p>
    <p><tt>pulp_install_plugins:</tt><tt><br>
      </tt><tt>  pulp-rpm:</tt><tt><br>
      </tt><tt>    app_label: "rpm"</tt><tt><br>
      </tt><tt>    source_dir:
        <a class="gmail-m_-2573507517161683878moz-txt-link-rfc2396E" href="mailto:git+https://github.com/pulp/pulp_rpm.git@3.0.0b3" target="_blank">"git+https://github.com/pulp/pulp_rpm.git@3.0.0b3"</a></tt><tt><br>
      </tt></p>
    <p>Can somebody help me on this ?</p>
    <p>Regards</p>
    <p>Juan<br>
    </p>
    <div class="gmail-m_-2573507517161683878moz-signature">-- <br>
      <div style="font-family:Verdana,Helvetica,Arial,sans-serif;font-size:8pt;font-weight:normal;color:rgb(97,99,101)"> <img src="cid:16b6adf9539ad2a3c201" style="display: block; margin: 1em 0em;">
        <p style="margin:1em"> <span style="font-weight:bold">Juan
            CABRERA</span><br>
          <span style="color:rgb(105,190,40)">Correspondant informatique</span><br>
          <span>Département de Mathématiques</span> </p>
        <p style="margin:1em">
          <span style="font-weight:bold">T.</span> 081724919<br>
          <a style="color:rgb(105,190,40)" href="mailto:juan.cabrera@unamur.be" target="_blank">juan.cabrera@unamur.be</a><br>
          <a style="color:rgb(105,190,40)" href="http://staff.unamur.be/jbcabrer" target="_blank">http://staff.unamur.be/jbcabrer</a>
        </p>
        <p style="margin:1em"> <span style="font-weight:bold;font-size:8pt">Université de Namur ASBL</span><br>
          <span>Rue de Bruxelles 61 - 5000 Namur</span><br>
          <span>Belgique</span><br>
        </p>
        <p style="margin:1em;font-size:6pt;color:rgb(105,190,40)"> <span>Let’s
            respect the environment together.</span><br>
          <span style="font-weight:bold">Only print this message if
            necessary!</span><br>
        </p>
      </div>
    </div>
  </div>

_______________________________________________<br>
Pulp-list mailing list<br>
<a href="mailto:Pulp-list@redhat.com" target="_blank">Pulp-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-list</a></blockquote></div></div>