Merge lp:~bac/charms/precise/juju-gui/expose-cookies into lp:~juju-gui/charms/precise/juju-gui/trunk

Proposed by Brad Crittenden
Status: Merged
Merged at revision: 69
Proposed branch: lp:~bac/charms/precise/juju-gui/expose-cookies
Merge into: lp:~juju-gui/charms/precise/juju-gui/trunk
Diff against target: 108 lines (+28/-4)
6 files modified
config.yaml (+10/-0)
config/config.js.template (+1/-0)
hooks/backend.py (+2/-1)
hooks/utils.py (+2/-1)
revision (+1/-1)
tests/test_utils.py (+12/-1)
To merge this branch: bzr merge lp:~bac/charms/precise/juju-gui/expose-cookies
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+170118@code.launchpad.net

Description of the change

Expose 'use-analytics' via the charm.

https://codereview.appspot.com/10395043/

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :
Download full text (5.4 KiB)

Reviewers: mp+170118_code.launchpad.net,

Message:
Please take a look.

Description:
Expose 'use-analytics' via the charm.

https://code.launchpad.net/~bac/charms/precise/juju-gui/expose-cookies/+merge/170118

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M config.yaml
   M config/config.js.template
   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-06-12 08:59:15 +0000
+++ config.yaml 2013-06-18 15:38:18 +0000
@@ -140,3 +140,13 @@
        'add-apt-repository'.
      type: string
      default: ppa:juju-gui-charmers/stable
+ use-analytics:
+ description: |
+ The team developing the Juju GUI benefits from understanding how
+ different deployments use the tool. By enabling this setting,
+ anonymized usage data is reported back using Google Analytics. The
type
+ of data collected includes the charms that are deployed and the
number
+ of units per service. Use of analytics is optional but we hope you
will
+ allow us to improve our tool based on your experience.
+ type: boolean
+ default: true

Index: revision
=== modified file 'revision'
--- revision 2013-06-12 09:07:29 +0000
+++ revision 2013-06-18 15:39:35 +0000
@@ -1,1 +1,1 @@
-53
+54

Index: config/config.js.template
=== modified file 'config/config.js.template'
--- config/config.js.template 2013-04-26 21:05:03 +0000
+++ config/config.js.template 2013-06-18 15:38:18 +0000
@@ -22,5 +22,6 @@
    apiBackend: {{api_backend}}, // Value can be 'python' or 'go'.
    readOnly: {{readonly}},
    sandbox: {{sandbox}},
+ useAnalytics: {{use_analytics}},
    login_help: {{login_help}}
  };

Index: hooks/backend.py
=== modified file 'hooks/backend.py'
--- hooks/backend.py 2013-06-11 14:04:04 +0000
+++ hooks/backend.py 2013-06-18 15:38:18 +0000
@@ -108,7 +108,8 @@
              config['juju-gui-console-enabled'], config['login-help'],
              config['read-only'], config['staging'],
config['ssl-cert-path'],
              config['charmworld-url'], config['serve-tests'],
- secure=config['secure'], sandbox=config['sandbox'])
+ secure=config['secure'], sandbox=config['sandbox'],
+ use_analytics=config['use-analytics'])
          charmhelpers.open_port(80)
          charmhelpers.open_port(443)

Index: hooks/utils.py
=== modified file 'hooks/utils.py'
--- hooks/utils.py 2013-06-12 08:59:15 +0000
+++ hooks/utils.py 2013-06-18 15:38:18 +0000
@@ -360,7 +360,7 @@
  def start_gui(
          console_enabled, login_help, readonly, in_staging, ssl_cert_path,
          charmworld_url, serve_tests,
haproxy_path='/etc/haproxy/haproxy.cfg',
- config_js_path=None, secure=True, sandbox=False):
...

Read more...

Revision history for this message
Nicola Larosa (teknico) wrote :

LGTM, where "G" means "flawless". :-)

https://codereview.appspot.com/10395043/

Revision history for this message
Madison Scott-Clary (makyo) wrote :

LGTM - thanks for getting this plugged in

https://codereview.appspot.com/10395043/

Revision history for this message
Brad Crittenden (bac) wrote :

*** Submitted:

Expose 'use-analytics' via the charm.

R=teknico, matthew.scott
CC=
https://codereview.appspot.com/10395043

https://codereview.appspot.com/10395043/

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-06-12 08:59:15 +0000
3+++ config.yaml 2013-06-18 15:47:28 +0000
4@@ -140,3 +140,13 @@
5 'add-apt-repository'.
6 type: string
7 default: ppa:juju-gui-charmers/stable
8+ use-analytics:
9+ description: |
10+ The team developing the Juju GUI benefits from understanding how
11+ different deployments use the tool. By enabling this setting,
12+ anonymized usage data is reported back using Google Analytics. The type
13+ of data collected includes the charms that are deployed and the number
14+ of units per service. Use of analytics is optional but we hope you will
15+ allow us to improve our tool based on your experience.
16+ type: boolean
17+ default: true
18
19=== modified file 'config/config.js.template'
20--- config/config.js.template 2013-04-26 21:05:03 +0000
21+++ config/config.js.template 2013-06-18 15:47:28 +0000
22@@ -22,5 +22,6 @@
23 apiBackend: {{api_backend}}, // Value can be 'python' or 'go'.
24 readOnly: {{readonly}},
25 sandbox: {{sandbox}},
26+ useAnalytics: {{use_analytics}},
27 login_help: {{login_help}}
28 };
29
30=== modified file 'hooks/backend.py'
31--- hooks/backend.py 2013-06-11 14:04:04 +0000
32+++ hooks/backend.py 2013-06-18 15:47:28 +0000
33@@ -108,7 +108,8 @@
34 config['juju-gui-console-enabled'], config['login-help'],
35 config['read-only'], config['staging'], config['ssl-cert-path'],
36 config['charmworld-url'], config['serve-tests'],
37- secure=config['secure'], sandbox=config['sandbox'])
38+ secure=config['secure'], sandbox=config['sandbox'],
39+ use_analytics=config['use-analytics'])
40 charmhelpers.open_port(80)
41 charmhelpers.open_port(443)
42
43
44=== modified file 'hooks/utils.py'
45--- hooks/utils.py 2013-06-12 08:59:15 +0000
46+++ hooks/utils.py 2013-06-18 15:47:28 +0000
47@@ -360,7 +360,7 @@
48 def start_gui(
49 console_enabled, login_help, readonly, in_staging, ssl_cert_path,
50 charmworld_url, serve_tests, haproxy_path='/etc/haproxy/haproxy.cfg',
51- config_js_path=None, secure=True, sandbox=False):
52+ config_js_path=None, secure=True, sandbox=False, use_analytics=False):
53 """Set up and start the Juju GUI server."""
54 with su('root'):
55 run('chown', '-R', 'ubuntu:', JUJU_GUI_DIR)
56@@ -400,6 +400,7 @@
57 'protocol': json.dumps(protocol),
58 'sandbox': json.dumps(sandbox),
59 'charmworld_url': json.dumps(charmworld_url),
60+ 'use_analytics': json.dumps(use_analytics),
61 }
62 if config_js_path is None:
63 config_js_path = os.path.join(
64
65=== modified file 'revision'
66--- revision 2013-06-12 09:07:29 +0000
67+++ revision 2013-06-18 15:47:28 +0000
68@@ -1,1 +1,1 @@
69-53
70+54
71
72=== modified file 'tests/test_utils.py'
73--- tests/test_utils.py 2013-06-11 14:04:04 +0000
74+++ tests/test_utils.py 2013-06-18 15:47:28 +0000
75@@ -637,7 +637,7 @@
76 start_gui(
77 False, 'This is login help.', True, True, ssl_cert_path,
78 charmworld_url, True, haproxy_path='haproxy',
79- config_js_path='config')
80+ config_js_path='config', use_analytics=True)
81 haproxy_conf = self.files['haproxy']
82 self.assertIn('ca-base {0}'.format(ssl_cert_path), haproxy_conf)
83 self.assertIn('crt-base {0}'.format(ssl_cert_path), haproxy_conf)
84@@ -655,6 +655,7 @@
85 self.assertIn("socket_url: 'wss://", js_conf)
86 self.assertIn('socket_protocol: "wss"', js_conf)
87 self.assertIn('charmworldURL: "http://charmworld.example"', js_conf)
88+ self.assertIn('useAnalytics: true', js_conf)
89 apache_conf = self.files['juju-gui']
90 self.assertIn('juju-gui/build-', apache_conf)
91 self.assertIn('VirtualHost *:{0}'.format(WEB_PORT), apache_conf)
92@@ -687,6 +688,16 @@
93 self.assertIn('user: "admin"', js_conf)
94 self.assertIn('password: "admin"', js_conf)
95
96+ def test_start_gui_no_analytics(self):
97+ ssl_cert_path = '/tmp/certificates/'
98+ charmworld_url = 'http://charmworld.example'
99+ start_gui(
100+ False, 'This is login help.', False, False, ssl_cert_path,
101+ charmworld_url, True, haproxy_path='haproxy',
102+ config_js_path='config', use_analytics=False)
103+ js_conf = self.files['config']
104+ self.assertIn('useAnalytics: false', js_conf)
105+
106
107 class TestNpmCache(unittest.TestCase):
108 """To speed building from a branch we prepopulate the NPM cache."""

Subscribers

People subscribed via source and target branches