~benji/charms/precise/juju-gui/use-known-pip

« back to all changes in this revision

Viewing changes to server/guiserver/handlers.py

  • Committer: Francesco Banconi
  • Date: 2013-11-07 19:43:05 UTC
  • mfrom: (121.1.4 improve-error-handling)
  • Revision ID: francesco.banconi@canonical.com-20131107194305-jf37dk0ky462ocsz
Improve bundle deployment error handling.

Workaround for http://bugs.python.org/issue1692335.

Include a customized jujuclient tarball in the
charm, The diff with the original is here:
http://pastebin.ubuntu.com/6377430/

Add a first fix to the testing environment creation
so that the local dependencies are installed
when available.

Also fixed the headers sent by the info handler.

Tests: make unittest

QA:
I used this bundle: http://pastebin.ubuntu.com/6377441/
to live test the branch.
Bootstrap a juju environment, run `make deploy` and then
switch the gui source to lp:juju-gui.
When everything is ready, try to deploy the bundle above:
it will fail because it includes local charms, but the
server will not explode, and it will be possible
to deploy other valid bundles after the first one.
The GUI user does not receive notifications, and that's
normal since deployments are not yet watched by the GUI.
Go to https://[GUI URL]/gui-server-info and you should
find the deployment status to be completed with the
expected error.

R=rharding, bac
CC=
https://codereview.appspot.com/23000043

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import time
23
23
 
24
24
from tornado import (
25
 
    escape,
26
25
    gen,
27
26
    web,
28
27
    websocket,
227
226
    def get(self):
228
227
        """Handle GET requests."""
229
228
        info = self.get_info(self.application.settings)
230
 
        self.write(escape.json_encode(info))
 
229
        # In Tornado Web handlers, just writing a dict JSON encodes the
 
230
        # response contents and sets the proper content type header
 
231
        # (application/json; charset=UTF-8).
 
232
        self.write(info)
231
233
 
232
234
 
233
235
class HttpsRedirectHandler(web.RequestHandler):