<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 11:06 PM, Craig Vyvial <span dir="ltr"><<a href="mailto:cp16net@gmail.com" target="_blank">cp16net@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">
<div class="">On Wed, Jul 30, 2014 at 10:10 AM, Denis Makogon <span dir="ltr"><<a href="mailto:dmakogon@mirantis.com" target="_blank">dmakogon@mirantis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify">

<span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">Hello, Stackers.</span></p>


<br><br><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">I’d like to gather Trove team around question related to Datastores/Version API responses (request/response payloads and HTTP codes).</span></p>


<br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;background-color:transparent">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;background-color:transparent">Small INFO</span></p>


<br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-indent:36pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">When deployer creates datastore and versions for it Troves` backend receives request to store DBDatastore and DBDatastoreVersion objects with certain parameters. The most interesting attribute of DBDatastoreVersion is “packages” - it’s being stored as String object (and it’s totally fine). But when we’re trying to query given datastore version through the Datastores API attribute “packages” is being returned as String object too. And it seems that it breaks response pattern - “If given attribute represents complex attribute, such as: list, dict, tuple - it should be returned as is.</span></p>


<br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-indent:36pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">So, the first question is - are we able to change it in terms of V1?</span></p>

</div></blockquote></div><div>If it does not break the public api then i do not think there is an issue making a change. </div></div></div></div></blockquote><div><br></div><div>If modification means "breaking" then yes. I would say that type 'packages' attribute should be changed to more appropriate type, such as list of string. But it seems that this modification would be possible in abstract V2,</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div>I made a change not long ago around making the packages a list thats sent to the guest. I'm a bit confused what you are wanting to change here.</div>
<div>Are you suggesting changing the data that is stored for packages (string to a json.dumps list or something). </div><div>Or making the model parse the string into a list when you request the packages for a datastore version?</div>
</div></div></div></blockquote><div>I guess last thing. If i want to iterate over packages i would need to manually split string an build appropriate data type. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-indent:36pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">The second question is about admin_context decorator (see [1]). This method executes methods of given controller and verifies that user is able to execute certain procedure.</span></p>


<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">Taking into account RFC 2616 this method should raise HTTP Forbidden (code 403) if user tried to execute request that he’s not allowed to.</span></p>


<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">But given method return HTTP Unauthorized (code 401) which seems weird since user is authorized.</span></p>

</div></blockquote></div><div>I think this is a valid bug for the error code although the message makes it clear why you get the 401.</div><div><a href="https://github.com/openstack/trove/blob/master/trove/common/auth.py#L85" target="_blank">https://github.com/openstack/trove/blob/master/trove/common/auth.py#L85</a><br>

</div><div> </div></div></div></div></blockquote><div>The problem is that user is authorized but doesn't have certain permissions. Unauthorized means that user passed wrong credentials, Forbidden (in terms of ReST) authorized but not permitted.</div>
<div><br></div><div>Craig, after digging into the problem i found out where current code is broken, see</div><div><a href="https://github.com/openstack/trove/blob/master/trove/common/wsgi.py#L316-L318">https://github.com/openstack/trove/blob/master/trove/common/wsgi.py#L316-L318</a><br>
</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div dir="ltr">
<br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">This is definitely a bug. And it comes from [2].</span></p>


<br><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">[1] </span><a href="https://github.com/openstack/trove/blob/master/trove/common/auth.py#L72-L87" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;background-color:transparent">https://github.com/openstack/trove/blob/master/trove/common/auth.py#L72-L87</span></a></p>


<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">[2] </span><a href="https://github.com/openstack/trove/blob/master/trove/common/wsgi.py#L316-L318" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;background-color:transparent">https://github.com/openstack/trove/blob/master/trove/common/wsgi.py#L316-L318</span></a></p>


<br><br><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">Best regards,</span></p>


<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;text-align:justify"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;background-color:transparent">Denis Makogon</span></p>


</div>
<br></div>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div></div>