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
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: config. js.template
A [revision details]
M config.yaml
M config/
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
'add-apt- repository' . gui-charmers/ stable
=== 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 @@
type: string
default: ppa:juju-
+ 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 config. js.template' config. js.template 2013-04-26 21:05:03 +0000 config. js.template 2013-06-18 15:38:18 +0000
=== modified file 'config/
--- config/
+++ config/
@@ -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
config[ 'juju-gui- console- enabled' ], config[ 'login- help'],
config[ 'read-only' ], config['staging'], 'ssl-cert- path'],
config[ 'charmworld- url'], config[ 'serve- tests'] , config[ 'secure' ], sandbox= config[ 'sandbox' ]) config[ 'secure' ], sandbox= config[ 'sandbox' ], config[ 'use-analytics' ])
charmhelpers .open_port( 80)
charmhelpers .open_port( 443)
=== 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[
- secure=
+ secure=
+ use_analytics=
Index: hooks/utils.py
console_ enabled, login_help, readonly, in_staging, ssl_cert_path,
charmworld_ url, serve_tests, path='/ etc/haproxy/ haproxy. cfg', js_path= None, secure=True, sandbox=False): js_path= None, secure=True, sandbox=False, False):
run( 'chown' , '-R', 'ubuntu:', JUJU_GUI_DIR)
'protocol' : json.dumps( protocol) ,
'sandbox' : json.dumps( sandbox) ,
'charmworld_ url': json.dumps( charmworld_ url), use_analytics) ,
config_ js_path = os.path.join(
=== 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(
haproxy_
- config_
+ config_
use_analytics=
"""Set up and start the Juju GUI server."""
with su('root'):
@@ -400,6 +400,7 @@
+ 'use_analytics': json.dumps(
}
if config_js_path is None:
Index: tests/test_utils.py test_utils. py'
start_ gui(
False, 'This is login help.', True, True, ssl_cert_path,
charmworld_ url, True, haproxy_ path='haproxy' , js_path= 'config' ) js_path= 'config' , use_analytics=True)
haproxy_ conf = self.files[ 'haproxy' ]
self. assertIn( 'ca-base {0}'.format( ssl_cert_ path), haproxy_conf)
self. assertIn( 'crt-base {0}'.format( ssl_cert_ path), haproxy_conf)
self. assertIn( "socket_ url: 'wss://", js_conf)
self. assertIn( 'socket_ protocol: "wss"', js_conf)
self. assertIn( 'charmworldURL: "http:// charmworld. example"', 'useAnalytics: true', js_conf)
apache_ conf = self.files[ 'juju-gui' ]
self. assertIn( 'juju-gui/ build-' , apache_conf)
self. assertIn( 'VirtualHost *:{0}'. format( WEB_PORT) , apache_conf)
self. assertIn( 'user: "admin"', js_conf)
self. assertIn( 'password: "admin"', js_conf)
=== modified file 'tests/
--- tests/test_utils.py 2013-06-11 14:04:04 +0000
+++ tests/test_utils.py 2013-06-18 15:38:18 +0000
@@ -637,7 +637,7 @@
- config_
+ config_
@@ -655,6 +655,7 @@
js_conf)
+ self.assertIn(
@@ -687,6 +688,16 @@
+ def test_start_ gui_no_ analytics( self): tes/' charmworld. example' path='haproxy' , js_path= 'config' , use_analytics= False) 'config' ] 'useAnalytics: false', js_conf)
+ ssl_cert_path = '/tmp/certifica
+ charmworld_url = 'http://
+ start_gui(
+ False, 'This is login help.', False, False, ssl_cert_path,
+ charmworld_url, True, haproxy_
+ config_
+ js_conf = self.files[
+ self.assertIn(
+
class TestNpmCache( unittest. TestCase) :
"""To speed building from a branch we prepopulate the NPM cache."""