OLD | NEW |
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 # -*- python -*- | 2 # -*- python -*- |
3 | 3 |
4 from subprocess import ( | 4 from subprocess import ( |
5 CalledProcessError, | 5 CalledProcessError, |
6 check_call, | 6 check_call, |
7 ) | 7 ) |
8 | 8 |
9 # python-shelltoolbox is installed as a dependency of python-charmhelpers. | 9 # python-shelltoolbox is installed as a dependency of python-charmhelpers. |
10 check_call(['apt-get', 'install', '-y', 'python-charmhelpers']) | 10 check_call(['apt-get', 'install', '-y', 'python-charmhelpers']) |
11 | 11 |
12 | 12 |
13 # These modules depend on charmhelpers and shelltoolbox being installed so they | 13 # These modules depend on charmhelpers and shelltoolbox being installed so they |
14 # must not be imported until those packages are available. | 14 # must not be imported until those packages are available. |
15 from charmhelpers import ( | 15 from charmhelpers import ( |
16 get_config, | 16 get_config, |
17 log, | 17 log, |
18 log_entry, | 18 log_entry, |
19 log_exit, | 19 log_exit, |
20 ) | 20 ) |
21 from shelltoolbox import ( | 21 from shelltoolbox import ( |
22 apt_get_install, | 22 apt_get_install, |
23 install_extra_repositories, | 23 install_extra_repositories, |
24 ) | 24 ) |
25 | 25 |
26 from utils import ( | 26 from utils import ( |
27 build, | |
28 cmd_log, | 27 cmd_log, |
29 config_json, | 28 config_json, |
30 fetch, | 29 fetch_api, |
31 ) | 30 fetch_gui, |
| 31 setup_gui, |
| 32 setup_nginx, |
| 33 ) |
32 | 34 |
33 | 35 |
34 DEB_DEPENDENCIES = ( | 36 DEB_DEPENDENCIES = ( |
35 'bzr', 'imagemagick', 'make', 'nginx', 'nodejs', 'npm', 'openssl', | 37 'bzr', 'imagemagick', 'make', 'nginx', 'nodejs', 'npm', 'openssl', |
36 'zookeeper') | 38 'python-launchpadlib', 'zookeeper', |
| 39 ) |
37 | 40 |
38 | 41 |
39 def get_dependencies(): | 42 def get_dependencies(): |
40 log('Installing dependencies.') | 43 log('Installing dependencies.') |
41 cmd_log(install_extra_repositories('ppa:chris-lea/node.js')) | 44 cmd_log(install_extra_repositories('ppa:chris-lea/node.js')) |
42 cmd_log(apt_get_install(*DEB_DEPENDENCIES)) | 45 cmd_log(apt_get_install(*DEB_DEPENDENCIES)) |
43 | 46 |
44 | 47 |
45 def main(): | 48 def main(): |
46 config = get_config() | 49 config = get_config() |
47 get_dependencies() | 50 get_dependencies() |
48 fetch(config['juju-gui-branch'], config['juju-api-branch']) | 51 release_tarball = fetch_gui( |
49 build(config['command-log-file'], config['ssl-cert-path']) | 52 config['juju-gui-source'], config['command-log-file']) |
| 53 setup_gui(release_tarball) |
| 54 setup_nginx(config['ssl-cert-path']) |
| 55 fetch_api(config['juju-api-branch']) |
50 config_json.set(config) | 56 config_json.set(config) |
51 | 57 |
52 | 58 |
53 if __name__ == '__main__': | 59 if __name__ == '__main__': |
54 log_entry() | 60 log_entry() |
55 try: | 61 try: |
56 main() | 62 main() |
57 except CalledProcessError as e: | 63 except CalledProcessError as e: |
58 log('Exception caught:') | 64 log('Exception caught:') |
59 log(e.output) | 65 log(e.output) |
60 raise | 66 raise |
61 finally: | 67 finally: |
62 log_exit() | 68 log_exit() |
OLD | NEW |