Merge lp:~frankban/charms/precise/juju-gui/separate-staging-debug into lp:~juju-gui/charms/precise/juju-gui/trunk

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 106
Proposed branch: lp:~frankban/charms/precise/juju-gui/separate-staging-debug
Merge into: lp:~juju-gui/charms/precise/juju-gui/trunk
Diff against target: 113 lines (+18/-13)
5 files modified
config.yaml (+8/-3)
hooks/backend.py (+3/-3)
hooks/utils.py (+2/-2)
revision (+1/-1)
tests/test_utils.py (+4/-4)
To merge this branch: bzr merge lp:~frankban/charms/precise/juju-gui/separate-staging-debug
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+185307@code.launchpad.net

Description of the change

Create a new option for GUI debug mode.

Setting the juju-gui-debug option to true is
now possible to serve the GUI source files
individually (uncompressed). As a consequence,
setting staging to true no longer activates
debug mode as a side effect.

QA:
- deploy the GUI from this branch (make deploy);
- run `juju set juju-gui juju-gui-debug=true`,
  wait a minute and then verify the uncompressed
  files are served by Apache;
- run `juju set juju-gui builtin-server=true`,
  wait a minute and then verify the uncompressed
  files are correctly served by the Tornado server
  (tailf /var/log/upstart/guiserver.log can help).

https://codereview.appspot.com/13301047/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :
Download full text (5.9 KiB)

Reviewers: mp+185307_code.launchpad.net,

Message:
Please take a look.

Description:
Create a new option for GUI debug mode.

Setting the juju-gui-debug option to true is
now possible to serve the GUI source files
individually (uncompressed). As a consequence,
setting staging to true no longer activates
debug mode as a side effect.

QA:
- deploy the GUI from this branch (make deploy);
- run `juju set juju-gui juju-gui-debug=true`,
   wait a minute and then verify the uncompressed
   files are served by Apache;
- run `juju set juju-gui builtin-server=true`,
   wait a minute and then verify the uncompressed
   files are correctly served by the Tornado server
   (tailf /var/log/upstart/guiserver.log can help).

https://code.launchpad.net/~frankban/charms/precise/juju-gui/separate-staging-debug/+merge/185307

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/13301047/

Affected files (+20, -13 lines):
   A [revision details]
   M config.yaml
   M hooks/backend.py
   M hooks/utils.py
   M revision
   M tests/test_utils.py

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: config.yaml
=== modified file 'config.yaml'
--- config.yaml 2013-08-26 12:18:19 +0000
+++ config.yaml 2013-09-12 14:29:45 +0000
@@ -32,6 +32,11 @@
          to pull a release from.
      type: string
      default: stable
+ juju-gui-debug:
+ description: |
+ Run Juju GUI in debug mode, serving the uncompressed GUI source
files.
+ type: boolean
+ default: false
    juju-api-branch:
      description: |
        The Juju API Bazaar branch (implementing the WebSocket server).
Since
@@ -42,9 +47,9 @@
    staging:
      description: |
        Connect the Juju GUI to the staging backend (i.e. a simulated Juju
- environment). Currently juju-core does not support the staging
- backend. For this reason, this option is ignored if the charm is
- deployed using juju-core.
+ environment). Currently juju-core does not support the staging
backend.
+ For this reason, an error is raised if this option is enabled in a
+ juju-core environment.
      type: boolean
      default: false
    staging-environment:

Index: revision
=== modified file 'revision'
--- revision 2013-09-04 09:05:19 +0000
+++ revision 2013-09-12 14:29:45 +0000
@@ -1,1 +1,1 @@
-82
+83

Index: hooks/backend.py
=== modified file 'hooks/backend.py'
--- hooks/backend.py 2013-09-03 08:24:30 +0000
+++ hooks/backend.py 2013-09-12 14:29:45 +0000
@@ -141,7 +141,7 @@
          charmhelpers.log('Starting Juju GUI.')
          config = backend.config
          build_dir = utils.compute_build_dir(
- config['staging'], config['serve-tests'])
+ config['juju-gui-debug'], config['serve-tests'])
          utils.write_gui_config(
              config['juju-gui-console-enabled'], config['login-help'],
              config['read-on...

Read more...

Revision history for this message
Richard Harding (rharding) wrote :

LGTM qa ok. Thanks so much for this!

https://codereview.appspot.com/13301047/

Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Create a new option for GUI debug mode.

Setting the juju-gui-debug option to true is
now possible to serve the GUI source files
individually (uncompressed). As a consequence,
setting staging to true no longer activates
debug mode as a side effect.

QA:
- deploy the GUI from this branch (make deploy);
- run `juju set juju-gui juju-gui-debug=true`,
   wait a minute and then verify the uncompressed
   files are served by Apache;
- run `juju set juju-gui builtin-server=true`,
   wait a minute and then verify the uncompressed
   files are correctly served by the Tornado server
   (tailf /var/log/upstart/guiserver.log can help).

R=rharding
CC=
https://codereview.appspot.com/13301047

https://codereview.appspot.com/13301047/

Revision history for this message
Francesco Banconi (frankban) wrote :

Hi Rick, thanks for the review!

https://codereview.appspot.com/13301047/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2013-08-26 12:18:19 +0000
3+++ config.yaml 2013-09-12 15:51:47 +0000
4@@ -32,6 +32,11 @@
5 to pull a release from.
6 type: string
7 default: stable
8+ juju-gui-debug:
9+ description: |
10+ Run Juju GUI in debug mode, serving the uncompressed GUI source files.
11+ type: boolean
12+ default: false
13 juju-api-branch:
14 description: |
15 The Juju API Bazaar branch (implementing the WebSocket server). Since
16@@ -42,9 +47,9 @@
17 staging:
18 description: |
19 Connect the Juju GUI to the staging backend (i.e. a simulated Juju
20- environment). Currently juju-core does not support the staging
21- backend. For this reason, this option is ignored if the charm is
22- deployed using juju-core.
23+ environment). Currently juju-core does not support the staging backend.
24+ For this reason, an error is raised if this option is enabled in a
25+ juju-core environment.
26 type: boolean
27 default: false
28 staging-environment:
29
30=== modified file 'hooks/backend.py'
31--- hooks/backend.py 2013-09-03 08:24:30 +0000
32+++ hooks/backend.py 2013-09-12 15:51:47 +0000
33@@ -141,7 +141,7 @@
34 charmhelpers.log('Starting Juju GUI.')
35 config = backend.config
36 build_dir = utils.compute_build_dir(
37- config['staging'], config['serve-tests'])
38+ config['juju-gui-debug'], config['serve-tests'])
39 utils.write_gui_config(
40 config['juju-gui-console-enabled'], config['login-help'],
41 config['read-only'], config['staging'], config['charmworld-url'],
42@@ -181,7 +181,7 @@
43 def start(self, backend):
44 config = backend.config
45 build_dir = utils.compute_build_dir(
46- config['staging'], config['serve-tests'])
47+ config['juju-gui-debug'], config['serve-tests'])
48 utils.start_haproxy_apache(
49 build_dir, config['serve-tests'], config['ssl-cert-path'],
50 config['secure'])
51@@ -204,7 +204,7 @@
52 def start(self, backend):
53 config = backend.config
54 build_dir = utils.compute_build_dir(
55- config['staging'], config['serve-tests'])
56+ config['juju-gui-debug'], config['serve-tests'])
57 utils.start_builtin_server(
58 build_dir, config['ssl-cert-path'], config['serve-tests'],
59 config['sandbox'], config['builtin-server-logging'],
60
61=== modified file 'hooks/utils.py'
62--- hooks/utils.py 2013-09-03 14:14:02 +0000
63+++ hooks/utils.py 2013-09-12 15:51:47 +0000
64@@ -387,7 +387,7 @@
65 cmd_log(run('rm', '-f', AGENT_INIT_PATH))
66
67
68-def compute_build_dir(in_staging, serve_tests):
69+def compute_build_dir(juju_gui_debug, serve_tests):
70 """Compute the build directory."""
71 with su('root'):
72 run('chown', '-R', 'ubuntu:', JUJU_GUI_DIR)
73@@ -395,7 +395,7 @@
74 # External insecure resources are still loaded when testing in the
75 # debug environment. For now, switch to the production environment if
76 # the charm is configured to serve tests.
77- if in_staging and not serve_tests:
78+ if juju_gui_debug and not serve_tests:
79 build_dirname = 'build-debug'
80 else:
81 build_dirname = 'build-prod'
82
83=== modified file 'revision'
84--- revision 2013-09-04 09:05:19 +0000
85+++ revision 2013-09-12 15:51:47 +0000
86@@ -1,1 +1,1 @@
87-82
88+83
89
90=== modified file 'tests/test_utils.py'
91--- tests/test_utils.py 2013-09-03 14:14:02 +0000
92+++ tests/test_utils.py 2013-09-12 15:51:47 +0000
93@@ -669,16 +669,16 @@
94 self.assertEqual(self.actions, [charmhelpers.STOP])
95
96 def test_compute_build_dir(self):
97- for (in_staging, serve_tests, result) in (
98+ for (juju_gui_debug, serve_tests, result) in (
99 (False, False, 'build-prod'),
100 (True, False, 'build-debug'),
101 (False, True, 'build-prod'),
102 (True, True, 'build-prod'),
103 ):
104- build_dir = compute_build_dir(in_staging, serve_tests)
105+ build_dir = compute_build_dir(juju_gui_debug, serve_tests)
106 self.assertIn(
107- result, build_dir, 'in_staging: {}, serve_tests: {}'.format(
108- in_staging, serve_tests))
109+ result, build_dir, 'debug: {}, serve_tests: {}'.format(
110+ juju_gui_debug, serve_tests))
111
112 def test_setup_haproxy_config(self):
113 setup_haproxy_config(self.ssl_cert_path)

Subscribers

People subscribed via source and target branches