<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 2014&#24180;01&#26376;21&#26085; 08:25, Christy Perez
      wrote:<br>
    </div>
    <blockquote cite="mid:1390263939.11592.12.camel@christy-toshiba"
      type="cite">
      <pre wrap="">Hi guys,

I'm having trouble following the logic for adding a new resource to the
API. Could someone outline the general steps you'd need to cover? </pre>
    </blockquote>
    Steps are:<br>
    1. update API.md -- it is for REST API user to read<br>
    2. update controller, adding the corresponding collection and
    resource to make it dispatch to the right model implementation.<br>
    &nbsp;&nbsp;&nbsp; Also, the API.json will be updated( if applicable), to specify
    the right parameter type and pattern of REST API<br>
    3. add model.py and mockmodel.py for implementation, this layer
    wraps libvirt call and the system lib<br>
    4. testcases, for tricky function we add unit test, for model we add
    test_model.py, for the controller logic and params checking, use
    test_rest.py.<br>
    5. when you add new file, update Makefile.am in its directory<br>
    &nbsp;&nbsp;&nbsp; when you add new python-lib, update spec file and README<br>
    <blockquote cite="mid:1390263939.11592.12.camel@christy-toshiba"
      type="cite">
      <pre wrap="">From
the patches on the mailing list, it looks like all anyone ever does is
new items to API.md -- but I'm getting a 404 not found error so I am
obviously missing something important.</pre>
    </blockquote>
    It is hard to say what causes this, maybe you can send an RFC to let
    guys to help you,<br>
    But a quick debug tip I usually use is:<br>
    in src/kimchi/control/base.py you can see these:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except NotFoundError, msg:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise cherrypy.HTTPError(404, "Not found: '%s'" %
    msg)--&gt;change it to <b>raise</b><br>
    Instead of let cherrypy handle it, I will raise this NotFoundError
    directly, this print the call stack and show me where exactly went
    wrong.<br>
    <blockquote cite="mid:1390263939.11592.12.camel@christy-toshiba"
      type="cite">
      <pre wrap="">

Thanks!

- Christy

_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>

</pre>
    </blockquote>
    <br>
  </body>
</html>