Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2032)

Delta Between Two Patch Sets: hooks/config-changed

Issue 6977043: Updated the charm to serve Juju GUI releases.
Left Patch Set: Updated the charm to serve Juju GUI releases. Created 12 years, 3 months ago
Right Patch Set: Updated the charm to serve Juju GUI releases. Created 12 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « config/nginx.conf.template ('k') | hooks/install » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 # -*- python -*- 2 # -*- python -*-
3 3
4 # Copyright 2012 Canonical Ltd. This software is licensed under the 4 # Copyright 2012 Canonical Ltd. This software is licensed under the
5 # GNU Affero General Public License version 3 (see the file LICENSE). 5 # GNU Affero General Public License version 3 (see the file LICENSE).
6 6
7 from subprocess import CalledProcessError 7 from subprocess import CalledProcessError
8 import sys 8 import sys
9 9
10 from charmhelpers import ( 10 from charmhelpers import (
(...skipping 25 matching lines...) Expand all
36 36
37 37
38 def handle_config_changes(config, diff): 38 def handle_config_changes(config, diff):
39 # Handle all configuration file changes. 39 # Handle all configuration file changes.
40 log('Updating configuration.') 40 log('Updating configuration.')
41 41
42 added_or_changed = diff.added_or_changed 42 added_or_changed = diff.added_or_changed
43 juju_api_port = config.get('juju-api-port') 43 juju_api_port = config.get('juju-api-port')
44 staging = config.get('staging') 44 staging = config.get('staging')
45 45
46 # The juju_gui_source_changed and juju_api_branch_changed variables
47 # control whether we restart the GUI and the API, respectively, at the
48 # end of the function.
46 juju_gui_source_changed = False 49 juju_gui_source_changed = False
47 juju_api_branch_changed = False 50 juju_api_branch_changed = False
48 51
49 # Fetch new sources? 52 # Fetch new sources?
50 # Restarting of the gui and api services is handled below.
51 if 'juju-gui-source' in added_or_changed: 53 if 'juju-gui-source' in added_or_changed:
52 juju_gui_source_changed = True 54 juju_gui_source_changed = True
53 release_tarball = fetch_gui( 55 release_tarball = fetch_gui(
54 config['juju-gui-source'], config['command-log-file']) 56 config['juju-gui-source'], config['command-log-file'])
55 setup_gui(release_tarball) 57 setup_gui(release_tarball)
56 setup_nginx() 58 setup_nginx(config['ssl-cert-path'])
57 if 'juju-api-branch' in added_or_changed: 59 if 'juju-api-branch' in added_or_changed:
58 juju_api_branch_changed = True 60 juju_api_branch_changed = True
59 fetch_api(config['juju-api-branch']) 61 fetch_api(config['juju-api-branch'])
60 62
61 # Handle changes to the improv server configuration. 63 # Handle changes to the improv server configuration.
62 if staging: 64 if staging:
63 staging_properties = set( 65 staging_properties = set(
64 ['staging', 'staging-environment', 'juju-api-port']) 66 ['staging', 'staging-environment', 'juju-api-port'])
65 staging_changed = added_or_changed & staging_properties 67 staging_changed = added_or_changed & staging_properties
66 if staging_changed or juju_api_branch_changed: 68 if staging_changed or juju_api_branch_changed:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if __name__ == '__main__': 121 if __name__ == '__main__':
120 log_entry() 122 log_entry()
121 try: 123 try:
122 main() 124 main()
123 except CalledProcessError as e: 125 except CalledProcessError as e:
124 log('Exception caught:') 126 log('Exception caught:')
125 log(e.output) 127 log(e.output)
126 raise 128 raise
127 finally: 129 finally:
128 log_exit() 130 log_exit()
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b