Merge lp:~bac/charms/precise/juju-gui/ga-key into lp:~juju-gui/charms/precise/juju-gui/trunk

Proposed by Brad Crittenden
Status: Merged
Merged at revision: 107
Proposed branch: lp:~bac/charms/precise/juju-gui/ga-key
Merge into: lp:~juju-gui/charms/precise/juju-gui/trunk
Diff against target: 125 lines (+15/-19)
5 files modified
config.yaml (+7/-6)
config/config.js.template (+1/-1)
hooks/backend.py (+1/-1)
hooks/utils.py (+3/-3)
tests/test_utils.py (+3/-8)
To merge this branch: bzr merge lp:~bac/charms/precise/juju-gui/ga-key
Reviewer Review Type Date Requested Status
Richard Harding Approve
charmers Pending
Review via email: mp+185294@code.launchpad.net

Description of the change

Make the Google Analytics key configurable.

To QA you can do the following:

(cd $HOME/charms/precise/juju-gui; make clean)
juju bootstrap -e goec2 --upload-tools
juju deploy -e goec2 --to 0 --repository=$HOME/charms local:juju-gui
juju set juju-gui juju-gui-source=lp:~bac/juju-gui/ga-key
juju expose -e goec2 juju-gui

When everything is happy you can confirm the old key is in use by:
juju get juju-gui
And verify the ga-key is the old one: UA-41463568-2

Change the key with
juju set juju-gui "ga-key=UA-1018242-44"

Now if you deploy a service using a novel name like "apache-bac" we should see that event appear in the GA logs.

To post a comment you must log in.
Revision history for this message
Richard Harding (rharding) wrote :

QA ok

#16 double space in there

Just a heads up, I found it easier to test with instructions I've gotten from francesco before:

- bzr branch .... bac-ga-key
- cd ...
- make deploy
- Now make the config change with juju set juju-gui "ga-key=UA-1018242-44"
- Verify that the key is changed in the window.juju_config

review: Approve
107. By Brad Crittenden

Remove use-analytics

108. By Brad Crittenden

Better description of ga-key

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-09-12 14:29:45 +0000
3+++ config.yaml 2013-09-12 19:50:53 +0000
4@@ -144,19 +144,20 @@
5 'add-apt-repository'.
6 type: string
7 default: ppa:juju-gui-charmers/stable
8- use-analytics:
9+ ga-key:
10 description: |
11+ The Google Analytics key to use. Set to blank to disable analytics.
12 The team developing the Juju GUI benefits from understanding how
13- different deployments use the tool. By enabling this setting,
14+ different deployments use the tool. By keeping the default key value,
15 anonymized usage data is reported back using Google Analytics. The type
16 of data collected includes the charms that are deployed and the number
17 of units per service. Use of analytics is optional but we hope you will
18 allow us to improve our tool based on your experience.
19- type: boolean
20- default: true
21+ type: string
22+ default: UA-41463568-2
23 default-viewmode:
24 description: |
25- What the charmbrowser's default viewmode should be. Possible options are:
26+ What the default viewmode for the charmbrowser should be. Possible options are:
27 - 'sidebar' (default): the charmwbrowser will appear as a sidebar. This
28 is also known as build mode.
29 - 'fullscreen': the charmbrowser will appear in full screen, hiding the
30@@ -190,7 +191,7 @@
31 A string that will be prepended to instance name to set the host name
32 in nagios. So for instance the hostname would be something like:
33 juju-myservice-0
34- If you're running multiple environments with the same services in them
35+ If you are running multiple environments with the same services in them
36 this allows you to differentiate between them.
37 type: string
38 default: "juju"
39
40=== modified file 'config/config.js.template'
41--- config/config.js.template 2013-08-14 18:14:11 +0000
42+++ config/config.js.template 2013-09-12 19:50:53 +0000
43@@ -22,7 +22,7 @@
44 apiBackend: {{api_backend}}, // Value can be 'python' or 'go'.
45 readOnly: {{readonly}},
46 sandbox: {{sandbox}},
47- useAnalytics: {{use_analytics}},
48+ GA_key: {{ga_key}},
49 login_help: {{login_help}},
50 defaultViewmode: {{default_viewmode}},
51 showGetJujuButton: {{show_get_juju_button}}
52
53=== modified file 'hooks/backend.py'
54--- hooks/backend.py 2013-09-12 14:29:45 +0000
55+++ hooks/backend.py 2013-09-12 19:50:53 +0000
56@@ -146,7 +146,7 @@
57 config['juju-gui-console-enabled'], config['login-help'],
58 config['read-only'], config['staging'], config['charmworld-url'],
59 build_dir, secure=config['secure'], sandbox=config['sandbox'],
60- use_analytics=config['use-analytics'],
61+ ga_key=config['ga-key'],
62 default_viewmode=config['default-viewmode'],
63 show_get_juju_button=config['show-get-juju-button'])
64 # Expose the service.
65
66=== modified file 'hooks/utils.py'
67--- hooks/utils.py 2013-09-12 14:29:45 +0000
68+++ hooks/utils.py 2013-09-12 19:50:53 +0000
69@@ -404,9 +404,9 @@
70
71 def write_gui_config(
72 console_enabled, login_help, readonly, in_staging, charmworld_url,
73- build_dir, secure=True, sandbox=False, use_analytics=False,
74+ build_dir, secure=True, sandbox=False,
75 default_viewmode='sidebar', show_get_juju_button=False,
76- config_js_path=None):
77+ config_js_path=None, ga_key=''):
78 """Generate the GUI configuration file."""
79 log('Generating the Juju GUI configuration file.')
80 is_legacy_juju = legacy_juju()
81@@ -433,7 +433,7 @@
82 'protocol': json.dumps(protocol),
83 'sandbox': json.dumps(sandbox),
84 'charmworld_url': json.dumps(charmworld_url),
85- 'use_analytics': json.dumps(use_analytics),
86+ 'ga_key': json.dumps(ga_key),
87 'default_viewmode': json.dumps(default_viewmode),
88 'show_get_juju_button': json.dumps(show_get_juju_button),
89 }
90
91=== modified file 'tests/test_utils.py'
92--- tests/test_utils.py 2013-09-12 14:29:45 +0000
93+++ tests/test_utils.py 2013-09-12 19:50:53 +0000
94@@ -770,7 +770,8 @@
95 def test_write_gui_config(self):
96 write_gui_config(
97 False, 'This is login help.', True, True, self.charmworld_url,
98- self.build_dir, use_analytics=True, config_js_path='config')
99+ self.build_dir, config_js_path='config',
100+ ga_key='UA-123456')
101 js_conf = self.files['config']
102 self.assertIn('consoleEnabled: false', js_conf)
103 self.assertIn('user: "admin"', js_conf)
104@@ -780,7 +781,7 @@
105 self.assertIn("socket_url: 'wss://", js_conf)
106 self.assertIn('socket_protocol: "wss"', js_conf)
107 self.assertIn('charmworldURL: "http://charmworld.example"', js_conf)
108- self.assertIn('useAnalytics: true', js_conf)
109+ self.assertIn('GA_key: "UA-123456"', js_conf)
110
111 def test_write_gui_config_insecure(self):
112 write_gui_config(
113@@ -804,12 +805,6 @@
114 self.assertIn('user: "admin"', js_conf)
115 self.assertIn('password: "admin"', js_conf)
116
117- def test_write_gui_config_no_analytics(self):
118- write_gui_config(
119- False, 'This is login help.', False, False, self.charmworld_url,
120- self.build_dir, use_analytics=False, config_js_path='config')
121- self.assertIn('useAnalytics: false', self.files['config'])
122-
123 def test_write_gui_config_fullscreen(self):
124 write_gui_config(
125 False, 'This is login help.', False, False, self.charmworld_url,

Subscribers

People subscribed via source and target branches