<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 23, 2017 at 10:56 AM, Jeff Ortel <span dir="ltr"><<a href="mailto:jortel@redhat.com" target="_blank">jortel@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is interesting.<br>
<br>
Some thoughts:<br>
<br>
If adopted, I propose the publication task create the publication and pass to the publisher which would<br>
require a change in the plugin API - Publisher.publish(publication)<wbr>.  If the publisher fails, I think the<br>
publication should be deleted.<br></blockquote><div><br></div><div>The ViewSet would create the publication, dispatch a publish task with the publication id as an argument, update the publication with the task id, return a serialized Publication to the API user. The user is responsible for deleting any publication that is not created successfully. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
On 10/19/2017 02:27 PM, Dennis Kliban wrote:<br>
> @jortel and I have been discussing[0] how a user should find out what publication was created after a request<br>
> is made to <a href="http://localhost:8000/api/v3/repositories/foo/publishers/example/bar/publish/" rel="noreferrer" target="_blank">http://localhost:8000/api/v3/r<wbr>epositories/foo/publishers/exa<wbr>mple/bar/publish/</a><br>
><br>
> I propose that we get rid of the above URL from our REST API and add ability to POST to<br>
> <a href="http://localhost:8000/api/v3/repositories/foo/publishers/example/bar/publications/" rel="noreferrer" target="_blank">http://localhost:8000/api/v3/r<wbr>epositories/foo/publishers/exa<wbr>mple/bar/publications/</a> instead. The response would<br>
> be a 201. Each publication would have a task associated with it.<br>
<br>
</span>Associated how?  I hope you are not suggesting adding Publication.task_id (FK).  I don't think that would be a<br>
good idea.<br></blockquote><div><br></div><div>That is exactly what I had in mind. Though the field can be NULL if the task has been removed from the database already. This way a serialized version of a Publication would provide a reference to a task that can be tracked to see if the publication was successfully created. If a failure occurs, the user can choose to delete the publication. Why do you think it's not a good idea to add this association? <br></div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I still like the idea of adding Publication.name as a natural key that can be specified by the user.  It can<br>
default to the task ID when not specified.  This gives users something meaningful to use when selecting a<br>
publication for association to a Distribution or when deleting.<br></blockquote><div><br></div><div>I also think it's valuable to let users name their publications. However, we should avoid forcing users to form URLs to resources on their own. Jeremy put it well in his response.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="m_5224024382257807675im m_5224024382257807675HOEnZb"><br>
><br>
> This work would probably be done by whoever picks up issue 3033[1].<br></span></blockquote><div><br></div><div>Since 3033 is well under way, this work would be done as issue 3035. <br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="m_5224024382257807675im m_5224024382257807675HOEnZb">
><br>
> [0] <a href="https://pulp.plan.io/issues/3035" rel="noreferrer" target="_blank">https://pulp.plan.io/issues/30<wbr>35</a><br>
> [1] <a href="https://pulp.plan.io/issues/3033" rel="noreferrer" target="_blank">https://pulp.plan.io/issues/30<wbr>33</a><br>
><br>
><br>
</span><div class="m_5224024382257807675HOEnZb"><div class="m_5224024382257807675h5">> ______________________________<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>
><br>
<br>
</div></div><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>
<br></blockquote></div><br></div></div>