<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 18, 2018 at 12:03 PM, Dennis Kliban <span dir="ltr"><<a href="mailto:dkliban@redhat.com" target="_blank">dkliban@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-">On Wed, Apr 18, 2018 at 11:02 AM, Simon Baatz <span dir="ltr"><<a href="mailto:gmbnomis@gmail.com" target="_blank">gmbnomis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am looking at Pulp 3 for the first time and have a question on<br>
creating/importing content units.<br>
<br>
In the file plugin, a file content unit can be created using<br>
POST@.../content/file/ by passing the meta-data ('relative_path') and the<br>
artifact (from which 'digest' is obtained as additional meta-data).  The<br>
POST is synchronous (returning a 201 CREATED if successful).<br>
<br>
However, for other artifact types there is more meta-data in the artifact(s)<br>
themselves and it may be "harder" to obtain.  For example, Puppet modules,<br>
Chef cookbooks, and Helm charts are tarballs with specific meta-data files. <br>
In Pulp 2, this meta-data extraction seems to be part of the<br>
import_uploaded_unit task.  According to the code comments, the puppet<br>
module unpacks the entire module to get the meta-data.<br>
<br>
If I got this correctly, Pulp 3 splits this up into content unit<br>
creation (sync) and "importing" (async, add content units using<br>
POST@...versions/).  Where should the meta-data extraction be done<br>
given this split?  (the first step is synchronous, but perhaps it is<br>
acceptable to do some work there nevertheless. The second step<br>
looks too late)<br>
<br></blockquote><div><br></div></span><div>The REST API provided by pulpcore in Pulp 3 is very generic. As you pointed out, it requires the REST API client to know all the metadata required to create a piece of Content from an Artifact. So I picture this process as a 3 step process in the client: <br><br>1) Inspect the artifact to extract all needed metadata<br></div><div>2) Use Artifact creation REST API to upload Artifact to Pulp<br></div><div>3) Use SomeContent creation REST API to create SomeContent from the uploaded Artifact and the metadata extracted in step 1 </div></div></div></div></blockquote><div><br></div><div>"smart upload" doesn't necessarily have to be a new endpoint.</div><div><br></div><div>1) POST /artifacts/</div><div>    user uploads artifact (just the tarball, no metadata needed)</div><div><br></div><div>2) POST /content/SomeUnit/</div><div>   user creates SomeUnit, and specifies the artifacts.  This is a plugin implemented endpoint already, and I think it makes sense to crack up the tarballs and create the metadata here. The call is currently synchronous though, we might want to make that async.</div><div><br></div><div><a href="https://github.com/pulp/pulp_file/blob/master/pulp_file/app/viewsets.py#L71">https://github.com/pulp/pulp_file/blob/master/pulp_file/app/viewsets.py#L71</a><br></div><div><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>With all that said, each plugin is also be able to provide additional REST API endpoints. I suspect that some of these endpoints will support "smart upload" that will be aware of the content type that is being uploaded. These endpoints will allow users to upload an Artifact of a specific type and the server will extract all the needed metadata to create the SomeContent in Pulp. <br></div><span class="gmail-"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
- Simon<br>
<br>
______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
</blockquote></span></div><br></div></div>
<br>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/pulp-dev</a><br>
<br></blockquote></div><br></div></div>