OLD | NEW |
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 #-*- python -*- | 2 #-*- python -*- |
3 | 3 |
4 from charmhelpers import ( | 4 from charmhelpers import ( |
5 get_config, | 5 get_config, |
6 log, | |
7 open_port, | |
8 ) | 6 ) |
9 | 7 |
10 from utils import ( | 8 from utils import ( |
11 legacy_juju, | |
12 log_hook, | 9 log_hook, |
13 start_agent, | |
14 start_gui, | |
15 start_improv, | |
16 ) | 10 ) |
17 | 11 |
18 | 12 from backend import Backend |
19 def open_ports(): | |
20 """Expose Juju GUI web server (HTTP and HTTPS) ports.""" | |
21 log('Exposing services.') | |
22 open_port(80) | |
23 open_port(443) | |
24 | 13 |
25 | 14 |
26 def main(): | 15 def main(): |
27 config = get_config() | 16 config = get_config() |
28 staging = config.get('staging') | 17 backend = Backend(config) |
29 # If juju-core is used, there is no need to start either the staging server | 18 backend.start() |
30 # (not supported) or the API agent (already included out of the box). | |
31 if legacy_juju(): | |
32 if staging: | |
33 start_improv( | |
34 config['staging-environment'], config['ssl-cert-path']) | |
35 else: | |
36 start_agent(config['ssl-cert-path']) | |
37 start_gui( | |
38 config['juju-gui-console-enabled'], config['login-help'], | |
39 config['read-only'], staging, config['ssl-cert-path'], | |
40 config['serve-tests'], secure=config['secure']) | |
41 open_ports() | |
42 | |
43 | 19 |
44 if __name__ == '__main__': | 20 if __name__ == '__main__': |
45 with log_hook(): | 21 with log_hook(): |
46 main() | 22 main() |
OLD | NEW |