On 2014年01月21日 08:25, Christy Perez
wrote:
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?
Steps are:
1. update API.md -- it is for REST API user to read
2. update controller, adding the corresponding collection and
resource to make it dispatch to the right model implementation.
Also, the API.json will be updated( if applicable), to specify
the right parameter type and pattern of REST API
3. add model.py and mockmodel.py for implementation, this layer
wraps libvirt call and the system lib
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.
5. when you add new file, update Makefile.am in its directory
when you add new python-lib, update spec file and README
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.
It is hard to say what causes this, maybe you can send an RFC to let
guys to help you,
But a quick debug tip I usually use is:
in src/kimchi/control/base.py you can see these:
except NotFoundError, msg:
raise cherrypy.HTTPError(404, "Not found: '%s'" %
msg)-->change it to raise
Instead of let cherrypy handle it, I will raise this NotFoundError
directly, this print the call stack and show me where exactly went
wrong.
Thanks!
- Christy
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel