Merge lp:~frankban/charms/precise/juju-gui/server-insecure-mode into lp:~juju-gui/charms/precise/juju-gui/trunk
Proposed by
Francesco Banconi
Status: | Merged |
---|---|
Merged at revision: | 82 |
Proposed branch: | lp:~frankban/charms/precise/juju-gui/server-insecure-mode |
Merge into: | lp:~juju-gui/charms/precise/juju-gui/trunk |
Diff against target: |
83 lines (+56/-2) 2 files modified
server/guiserver/manage.py (+12/-2) server/guiserver/tests/test_manage.py (+44/-0) |
To merge this branch: | bzr merge lp:~frankban/charms/precise/juju-gui/server-insecure-mode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
charmers | Pending | ||
Review via email:
|
Description of the change
Support serving the GUI over a non secure conn.
The GUI server can be configured to run the
GUI static files server and the WebSocket server over
an HTTP connection.
This way we support the secure=false charm option.
Tests:
Run `make unittest` from the branch root.
To post a comment you must log in.
Reviewers: mp+177649_ code.launchpad. net,
Message:
Please take a look.
Description:
Support serving the GUI over a non secure conn.
The GUI server can be configured to run the
GUI static files server and the WebSocket server over
an HTTP connection.
This way we support the secure=false charm option.
Tests:
Run `make unittest` from the branch root.
https:/ /code.launchpad .net/~frankban/ charms/ precise/ juju-gui/ server- insecure- mode/+merge/ 177649
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/12088046/
Affected files: guiserver/ manage. py guiserver/ tests/test_ manage. py
A [revision details]
M server/
M server/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision:
<email address hidden>
Index: server/ guiserver/ manage. py guiserver/ manage. py' guiserver/ manage. py 2013-07-25 16:41:45 +0000 guiserver/ manage. py 2013-07-30 16:51:58 +0000
'sslpath' , type=str, default= DEFAULT_ SSL_PATH, command_ line() validate_ required( 'guiroot' , 'apiurl')
=== modified file 'server/
--- server/
+++ server/
@@ -105,6 +105,11 @@
define(
help='The path where the SSL certificates are stored.')
+ define(
+ 'http', type=bool, default=False,
+ help='In order to run the GUI over a non secure connection (HTTP)
set '
+ 'this flag to True. Do not set this property unless you '
+ 'understand and accept the risks.')
# In Tornado, parsing the options also sets up the default logger.
parse_
_
@@ -114,8 +119,13 @@
def run(): ).listen( 443, ssl_options= _get_ssl_ options( )) ).listen( 80) ).listen( 443, ssl_options= _get_ssl_ options( )) ).listen( 80) get_version( ) info('starting Juju GUI server v{}'.format( version) ) instance( ).start( )
"""Run the server"""
- server(
- redirector(
+ if options.http:
+ # Run the server over HTTP.
+ server().listen(80)
+ else:
+ # Default configuration: run the server over a secure connection.
+ server(
+ redirector(
version = guiserver.
logging.
IOLoop.
Index: server/ guiserver/ tests/test_ manage. py guiserver/ tests/test_ manage. py' guiserver/ tests/test_ manage. py 2013-07-26 09:22:03 +0000 guiserver/ tests/test_ manage. py 2013-07-30 16:41:48 +0000
=== modified file 'server/
--- server/
+++ server/
@@ -16,7 +16,10 @@
"""Tests for the Juju GUI server management helpers."""
-from contextlib import contextmanager
+from contextlib import (
+ contextmanager,
+ nested,
+)
import logging
import unittest
@@ -136,3 +139,49 @@ 'guiserver. manage. options' , mock_options):
self.assertEqua l(expected, manage. _get_ssl_ options( )) unittest. TestCase) :
}
with mock.patch(
+
+
+class TestRun(
+
+ def mock_and_run(self, **kwargs):
+ """Run the application after mocking the IO loop and the
options/apps.
+
+ Additional options can be specified using kwargs.
+ """
+...