Merge lp:~gary/charms/precise/juju-gui/update-for-jujucharms into lp:~juju-gui/charms/precise/juju-gui/trunk
- Precise Pangolin (12.04)
- update-for-jujucharms
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 48 |
Proposed branch: | lp:~gary/charms/precise/juju-gui/update-for-jujucharms |
Merge into: | lp:~juju-gui/charms/precise/juju-gui/trunk |
Diff against target: |
313 lines (+105/-20) 10 files modified
.bzrignore (+1/-0) config.yaml (+6/-0) config/config.js.template (+1/-0) hooks/backend.py (+2/-2) hooks/install (+23/-5) hooks/utils.py (+13/-4) hooks/web-relation-joined (+23/-0) revision (+1/-1) tests/deploy.test (+4/-4) tests/test_utils.py (+31/-4) |
To merge this branch: | bzr merge lp:~gary/charms/precise/juju-gui/update-for-jujucharms |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
charmers | Pending | ||
Review via email: mp+161298@code.launchpad.net |
Commit message
Description of the change
Fix charm for jujucharms.com use
- Merge work from mews to support exec.d directory and relative file paths. Add tests.
- Merge work from benji to support charmworld option needed by upcoming gui changes. Make a small fix.
- Fix deploy tests.
Tests are still fragile, but I got them all to pass with the current branch at one time, and verified manually that the various steps still work.
Gary Poster (gary) wrote : | # |
Gary Poster (gary) wrote : | # |
Reviewers: mp+161298_
Message:
Please take a look.
Description:
Fix charm for jujucharms.com use
- Merge work from mews to support exec.d directory and relative file
paths. Add tests.
- Merge work from benji to support charmworld option needed by upcoming
gui changes. Make a small fix.
- Fix deploy tests.
Tests are still fragile, but I got them all to pass with the current
branch at one time, and verified manually that the various steps still
work.
https:/
(do not edit description out of merge proposal)
Please review this at https:/
Affected files:
M .bzrignore
A [revision details]
M config.yaml
M config/
M hooks/backend.py
M hooks/install
M hooks/utils.py
A hooks/web-
M revision
M tests/deploy.test
M tests/test_utils.py
Richard Harding (rharding) wrote : | # |
LGTM, thanks for working through it.
- 51. By Gary Poster
-
respond to review
Gary Poster (gary) wrote : | # |
*** Submitted:
Fix charm for jujucharms.com use
- Merge work from mews to support exec.d directory and relative file
paths. Add tests.
- Merge work from benji to support charmworld option needed by upcoming
gui changes. Make a small fix.
- Fix deploy tests.
Tests are still fragile, but I got them all to pass with the current
branch at one time, and verified manually that the various steps still
work.
R=rharding, benji
CC=
https:/
https:/
File hooks/install (right):
https:/
hooks/install:46: for module in os.listdir(
On 2013/04/27 20:29:30, benji wrote:
> Usually ".d" files are to be run in lexicographic order, so throwing a
sort()
> around the listdir would be good.
Good idea in the abstract, and I changed it.
FWIW, this code is provided by IS for their use, and I don't like the
pattern and at least mew has agreed with me, so I'm not super excited
about improving it. Your ideas were good, though, so I grudgingly did
them anyway. :-)
https:/
hooks/install:49: except OSError:
On 2013/04/27 20:29:30, benji wrote:
> It would be safer if we knew which OSErrors in particular we should
ignore. It
> would also be nice to know why we are ignoring them (i.e., a comment).
OK, good point...I did it, because I agree with you, though I had to
guess at their intent. Hopefully I got it right. :-/
https:/
File hooks/utils.py (right):
https:/
hooks/utils.py:195: """Log when a hook starts and stops its execution.
On 2013/04/27 20:29:30, benji wrote:
> Yay! I hate the "an" before non-silent "h" thing.
> I know, I know; I'm weird.
heh
https:/
hooks/utils.py:228: if source[0] != '/':
On 2013/04/27 20:29:30, benji wrote:
> I don't really prefer it, but just in case you do:
> if not source.
Yeah, I do, thanks. Changed.
https:/
File hooks/web-
https:/
hooks/web-
On 2013/04/27 20:29:30, benji wrote:
> Unnecessary newline.
I was doing as the Romans do, but eh, I don't think the Romans will
notice. Deleted.
https:/
hooks/web-
On 2013/04/27 20:29:30, benji wrote:
> You can use a one-liner here.
Again, I was following the local patterns in the charm, but eh, I agree.
Changed.
https:/
hooks/web-
On 2013/04/27 20:29:30, benji wrote:
> I'm pretty sure lines 16-18 are equivalent to
> hostname = socket.getfqdn()
I stared at this for a bit. I think you are probably right. What I had
here is what the haproxy or apache2 charms are...
Gary Poster (gary) wrote : | # |
thank you both!
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2013-04-15 17:47:54 +0000 | |||
3 | +++ .bzrignore 2013-04-28 01:09:28 +0000 | |||
4 | @@ -1,2 +1,3 @@ | |||
5 | 1 | .emacs* | 1 | .emacs* |
6 | 2 | tags | 2 | tags |
7 | 3 | exec.d/* | ||
8 | 3 | 4 | ||
9 | === modified file 'config.yaml' | |||
10 | --- config.yaml 2013-04-17 19:31:56 +0000 | |||
11 | +++ config.yaml 2013-04-28 01:09:28 +0000 | |||
12 | @@ -112,3 +112,9 @@ | |||
13 | 112 | the source: hooks/install and hooks/backend.py in particular. | 112 | the source: hooks/install and hooks/backend.py in particular. |
14 | 113 | type: boolean | 113 | type: boolean |
15 | 114 | default: true | 114 | default: true |
16 | 115 | charmworld-url: | ||
17 | 116 | description: | | ||
18 | 117 | The URL of the charm catalog site ("charmworld") from which charm catalog | ||
19 | 118 | data will be drawn. | ||
20 | 119 | type: string | ||
21 | 120 | default: http://staging.jujucharms.com | ||
22 | 115 | 121 | ||
23 | === modified file 'config/config.js.template' | |||
24 | --- config/config.js.template 2013-04-12 10:09:32 +0000 | |||
25 | +++ config/config.js.template 2013-04-28 01:09:28 +0000 | |||
26 | @@ -11,6 +11,7 @@ | |||
27 | 11 | // SubApps. | 11 | // SubApps. |
28 | 12 | consoleEnabled: {{console_enabled}}, | 12 | consoleEnabled: {{console_enabled}}, |
29 | 13 | charm_store_url: 'https://jujucharms.com/', | 13 | charm_store_url: 'https://jujucharms.com/', |
30 | 14 | charmworldURL: {{charmworld_url}}, | ||
31 | 14 | // socket_url is only honored in older versions of the GUI. | 15 | // socket_url is only honored in older versions of the GUI. |
32 | 15 | socket_url: '{{raw_protocol}}://{{address}}/ws', | 16 | socket_url: '{{raw_protocol}}://{{address}}/ws', |
33 | 16 | // socket_protocol is used instead by newer versions of the GUI to | 17 | // socket_protocol is used instead by newer versions of the GUI to |
34 | 17 | 18 | ||
35 | === added directory 'exec.d' | |||
36 | === modified file 'hooks/backend.py' | |||
37 | --- hooks/backend.py 2013-04-24 13:18:22 +0000 | |||
38 | +++ hooks/backend.py 2013-04-28 01:09:28 +0000 | |||
39 | @@ -107,8 +107,8 @@ | |||
40 | 107 | start_gui( | 107 | start_gui( |
41 | 108 | config['juju-gui-console-enabled'], config['login-help'], | 108 | config['juju-gui-console-enabled'], config['login-help'], |
42 | 109 | config['read-only'], config['staging'], config['ssl-cert-path'], | 109 | config['read-only'], config['staging'], config['ssl-cert-path'], |
45 | 110 | config['serve-tests'], secure=config['secure'], | 110 | config['charmworld-url'], config['serve-tests'], |
46 | 111 | sandbox=config['sandbox']) | 111 | secure=config['secure'], sandbox=config['sandbox']) |
47 | 112 | open_port(80) | 112 | open_port(80) |
48 | 113 | open_port(443) | 113 | open_port(443) |
49 | 114 | 114 | ||
50 | 115 | 115 | ||
51 | === modified file 'hooks/install' | |||
52 | --- hooks/install 2013-04-24 10:46:20 +0000 | |||
53 | +++ hooks/install 2013-04-28 01:09:28 +0000 | |||
54 | @@ -1,8 +1,9 @@ | |||
55 | 1 | #!/usr/bin/env python2 | 1 | #!/usr/bin/env python2 |
56 | 2 | # -*- python -*- | 2 | # -*- python -*- |
57 | 3 | 3 | ||
58 | 4 | import errno | ||
59 | 4 | import json | 5 | import json |
61 | 5 | from subprocess import check_call | 6 | import os |
62 | 6 | 7 | ||
63 | 7 | # If the user's environment has "juju-origin: ppa" set, they will | 8 | # If the user's environment has "juju-origin: ppa" set, they will |
64 | 8 | # automatically have access to python-charmhelpers and python-shelltoolbox. | 9 | # automatically have access to python-charmhelpers and python-shelltoolbox. |
65 | @@ -27,18 +28,35 @@ | |||
66 | 27 | 'python-apt', 'python-charmhelpers', 'python-launchpadlib', | 28 | 'python-apt', 'python-charmhelpers', 'python-launchpadlib', |
67 | 28 | 'python-shelltoolbox', 'python-tempita', | 29 | 'python-shelltoolbox', 'python-tempita', |
68 | 29 | ) | 30 | ) |
72 | 30 | check_call(('apt-get', 'install', '-y') + PYTHON_DEPENDENCIES) | 31 | bootstrap_utils.run(*(('apt-get', 'install', '-y') + PYTHON_DEPENDENCIES)) |
73 | 31 | 32 | ||
74 | 32 | 33 | ||
75 | 34 | from charmhelpers import log | ||
76 | 33 | from utils import ( | 35 | from utils import ( |
77 | 34 | config_json, | 36 | config_json, |
78 | 35 | log_hook, | 37 | log_hook, |
79 | 36 | ) | 38 | ) |
80 | 37 | |||
81 | 38 | from backend import Backend | 39 | from backend import Backend |
82 | 39 | 40 | ||
83 | 40 | 41 | ||
84 | 41 | def main(): | 42 | def main(): |
85 | 43 | # Run pre-install tasks, if available. Please do not rely on the | ||
86 | 44 | # exec.d interface without conferring with the Juju GUI team: it may | ||
87 | 45 | # change after upcoming discussion with Canonical IS. | ||
88 | 46 | if os.path.isdir('exec.d'): | ||
89 | 47 | dirnames = os.listdir('exec.d') | ||
90 | 48 | dirnames.sort() | ||
91 | 49 | for module in dirnames: | ||
92 | 50 | filename = os.path.join('exec.d', module, 'charm-pre-install') | ||
93 | 51 | try: | ||
94 | 52 | bootstrap_utils.run(filename) | ||
95 | 53 | except OSError, e: | ||
96 | 54 | # If the exec.d file does not exist or is not runnable, | ||
97 | 55 | # assume we can recover. Log the problem and proceed. | ||
98 | 56 | if e.errno in (errno.ENOENT, errno.EACCES): | ||
99 | 57 | log('{}: {}'.format(e.strerror, filename)) | ||
100 | 58 | else: | ||
101 | 59 | raise | ||
102 | 42 | config = get_config() | 60 | config = get_config() |
103 | 43 | backend = Backend(config) | 61 | backend = Backend(config) |
104 | 44 | backend.install() | 62 | backend.install() |
105 | 45 | 63 | ||
106 | === modified file 'hooks/utils.py' | |||
107 | --- hooks/utils.py 2013-04-25 16:46:07 +0000 | |||
108 | +++ hooks/utils.py 2013-04-28 01:09:28 +0000 | |||
109 | @@ -45,6 +45,7 @@ | |||
110 | 45 | import shutil | 45 | import shutil |
111 | 46 | from subprocess import CalledProcessError | 46 | from subprocess import CalledProcessError |
112 | 47 | import tempfile | 47 | import tempfile |
113 | 48 | from urlparse import urlparse | ||
114 | 48 | 49 | ||
115 | 49 | from launchpadlib.launchpad import Launchpad | 50 | from launchpadlib.launchpad import Launchpad |
116 | 50 | from shelltoolbox import ( | 51 | from shelltoolbox import ( |
117 | @@ -191,7 +192,7 @@ | |||
118 | 191 | 192 | ||
119 | 192 | @contextmanager | 193 | @contextmanager |
120 | 193 | def log_hook(): | 194 | def log_hook(): |
122 | 194 | """Log when an hook starts and stops its execution. | 195 | """Log when a hook starts and stops its execution. |
123 | 195 | 196 | ||
124 | 196 | Also log to stdout possible CalledProcessError exceptions raised executing | 197 | Also log to stdout possible CalledProcessError exceptions raised executing |
125 | 197 | the hook. | 198 | the hook. |
126 | @@ -217,10 +218,17 @@ | |||
127 | 217 | - ('stable', '0.1.0'): stable release v0.1.0; | 218 | - ('stable', '0.1.0'): stable release v0.1.0; |
128 | 218 | - ('trunk', None): latest trunk release; | 219 | - ('trunk', None): latest trunk release; |
129 | 219 | - ('trunk', '0.1.0+build.1'): trunk release v0.1.0 bzr revision 1; | 220 | - ('trunk', '0.1.0+build.1'): trunk release v0.1.0 bzr revision 1; |
131 | 220 | - ('branch', 'lp:juju-gui'): release is made from a branch. | 221 | - ('branch', 'lp:juju-gui'): release is made from a branch; |
132 | 222 | - ('url', 'http://example.com/gui'): release from a downloaded file. | ||
133 | 221 | """ | 223 | """ |
134 | 222 | if source.startswith('url:'): | 224 | if source.startswith('url:'): |
136 | 223 | return 'url', source[4:] | 225 | source = source[4:] |
137 | 226 | # Support file paths, including relative paths. | ||
138 | 227 | if urlparse(source).scheme == '': | ||
139 | 228 | if not source.startswith('/'): | ||
140 | 229 | source = os.path.join(os.path.abspath(CURRENT_DIR), source) | ||
141 | 230 | source = "file://%s" % source | ||
142 | 231 | return 'url', source | ||
143 | 224 | if source in ('stable', 'trunk'): | 232 | if source in ('stable', 'trunk'): |
144 | 225 | return source, None | 233 | return source, None |
145 | 226 | if source.startswith('lp:') or source.startswith('http://'): | 234 | if source.startswith('lp:') or source.startswith('http://'): |
146 | @@ -310,7 +318,7 @@ | |||
147 | 310 | 318 | ||
148 | 311 | def start_gui( | 319 | def start_gui( |
149 | 312 | console_enabled, login_help, readonly, in_staging, ssl_cert_path, | 320 | console_enabled, login_help, readonly, in_staging, ssl_cert_path, |
151 | 313 | serve_tests, haproxy_path='/etc/haproxy/haproxy.cfg', | 321 | charmworld_url, serve_tests, haproxy_path='/etc/haproxy/haproxy.cfg', |
152 | 314 | config_js_path=None, secure=True, sandbox=False): | 322 | config_js_path=None, secure=True, sandbox=False): |
153 | 315 | """Set up and start the Juju GUI server.""" | 323 | """Set up and start the Juju GUI server.""" |
154 | 316 | with su('root'): | 324 | with su('root'): |
155 | @@ -350,6 +358,7 @@ | |||
156 | 350 | 'user': json.dumps(user), | 358 | 'user': json.dumps(user), |
157 | 351 | 'protocol': json.dumps(protocol), | 359 | 'protocol': json.dumps(protocol), |
158 | 352 | 'sandbox': json.dumps(sandbox), | 360 | 'sandbox': json.dumps(sandbox), |
159 | 361 | 'charmworld_url': json.dumps(charmworld_url), | ||
160 | 353 | } | 362 | } |
161 | 354 | if config_js_path is None: | 363 | if config_js_path is None: |
162 | 355 | config_js_path = os.path.join( | 364 | config_js_path = os.path.join( |
163 | 356 | 365 | ||
164 | === added file 'hooks/web-relation-joined' | |||
165 | --- hooks/web-relation-joined 1970-01-01 00:00:00 +0000 | |||
166 | +++ hooks/web-relation-joined 2013-04-28 01:09:28 +0000 | |||
167 | @@ -0,0 +1,23 @@ | |||
168 | 1 | #!/usr/bin/env python2 | ||
169 | 2 | #-*- python -*- | ||
170 | 3 | |||
171 | 4 | import socket | ||
172 | 5 | from charmhelpers import ( | ||
173 | 6 | get_config, | ||
174 | 7 | relation_set, | ||
175 | 8 | ) | ||
176 | 9 | from utils import log_hook | ||
177 | 10 | |||
178 | 11 | |||
179 | 12 | def main(): | ||
180 | 13 | hostname = socket.getfqdn() | ||
181 | 14 | config = get_config() | ||
182 | 15 | if config['secure']: | ||
183 | 16 | port = 443 | ||
184 | 17 | else: | ||
185 | 18 | port = 80 | ||
186 | 19 | relation_set(port=port, hostname=hostname) | ||
187 | 20 | |||
188 | 21 | if __name__ == '__main__': | ||
189 | 22 | with log_hook(): | ||
190 | 23 | main() | ||
191 | 0 | 24 | ||
192 | === modified file 'revision' | |||
193 | --- revision 2013-04-23 07:32:46 +0000 | |||
194 | +++ revision 2013-04-28 01:09:28 +0000 | |||
195 | @@ -1,1 +1,1 @@ | |||
197 | 1 | 34 | 1 | 40 |
198 | 2 | 2 | ||
199 | === modified file 'tests/deploy.test' | |||
200 | --- tests/deploy.test 2013-03-13 21:24:31 +0000 | |||
201 | +++ tests/deploy.test 2013-04-28 01:09:28 +0000 | |||
202 | @@ -166,7 +166,7 @@ | |||
203 | 166 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. | 166 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. |
204 | 167 | self.addCleanup( | 167 | self.addCleanup( |
205 | 168 | self.stop_services, | 168 | self.stop_services, |
207 | 169 | hostname, ['haproxy', 'nginx', 'juju-api-agent']) | 169 | hostname, ['haproxy', 'apache2', 'juju-api-agent']) |
208 | 170 | self.navigate_to(hostname) | 170 | self.navigate_to(hostname) |
209 | 171 | self.handle_browser_warning() | 171 | self.handle_browser_warning() |
210 | 172 | self.assertEnvironmentIsConnected() | 172 | self.assertEnvironmentIsConnected() |
211 | @@ -177,7 +177,7 @@ | |||
212 | 177 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. | 177 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. |
213 | 178 | self.addCleanup( | 178 | self.addCleanup( |
214 | 179 | self.stop_services, | 179 | self.stop_services, |
216 | 180 | hostname, ['haproxy', 'nginx', 'juju-api-improv']) | 180 | hostname, ['haproxy', 'apache2', 'juju-api-improv']) |
217 | 181 | self.navigate_to(hostname) | 181 | self.navigate_to(hostname) |
218 | 182 | self.handle_browser_warning() | 182 | self.handle_browser_warning() |
219 | 183 | self.assertEnvironmentIsConnected() | 183 | self.assertEnvironmentIsConnected() |
220 | @@ -190,7 +190,7 @@ | |||
221 | 190 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. | 190 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. |
222 | 191 | self.addCleanup( | 191 | self.addCleanup( |
223 | 192 | self.stop_services, | 192 | self.stop_services, |
225 | 193 | hostname, ['haproxy', 'nginx', 'juju-api-agent']) | 193 | hostname, ['haproxy', 'apache2', 'juju-api-agent']) |
226 | 194 | self.navigate_to(hostname) | 194 | self.navigate_to(hostname) |
227 | 195 | self.handle_browser_warning() | 195 | self.handle_browser_warning() |
228 | 196 | self.assertEnvironmentIsConnected() | 196 | self.assertEnvironmentIsConnected() |
229 | @@ -222,7 +222,7 @@ | |||
230 | 222 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. | 222 | # XXX 2012-11-29 frankban bug=872264: see *stop_services* above. |
231 | 223 | self.addCleanup( | 223 | self.addCleanup( |
232 | 224 | self.stop_services, | 224 | self.stop_services, |
234 | 225 | hostname, ['haproxy', 'nginx', 'juju-api-agent']) | 225 | hostname, ['haproxy', 'apache2', 'juju-api-agent']) |
235 | 226 | self.navigate_to(hostname) | 226 | self.navigate_to(hostname) |
236 | 227 | self.handle_browser_warning() | 227 | self.handle_browser_warning() |
237 | 228 | self.assertEnvironmentIsConnected() | 228 | self.assertEnvironmentIsConnected() |
238 | 229 | 229 | ||
239 | === modified file 'tests/test_utils.py' | |||
240 | --- tests/test_utils.py 2013-04-23 16:55:56 +0000 | |||
241 | +++ tests/test_utils.py 2013-04-28 01:09:28 +0000 | |||
242 | @@ -366,6 +366,15 @@ | |||
243 | 366 | 366 | ||
244 | 367 | class ParseSourceTest(unittest.TestCase): | 367 | class ParseSourceTest(unittest.TestCase): |
245 | 368 | 368 | ||
246 | 369 | def setUp(self): | ||
247 | 370 | # Monkey patch utils.CURRENT_DIR. | ||
248 | 371 | self.original_current_dir = utils.CURRENT_DIR | ||
249 | 372 | utils.CURRENT_DIR = '/current/dir' | ||
250 | 373 | |||
251 | 374 | def tearDown(self): | ||
252 | 375 | # Restore the original utils.CURRENT_DIR. | ||
253 | 376 | utils.CURRENT_DIR = self.original_current_dir | ||
254 | 377 | |||
255 | 369 | def test_latest_stable_release(self): | 378 | def test_latest_stable_release(self): |
256 | 370 | # Ensure the latest stable release is correctly parsed. | 379 | # Ensure the latest stable release is correctly parsed. |
257 | 371 | expected = ('stable', None) | 380 | expected = ('stable', None) |
258 | @@ -392,6 +401,19 @@ | |||
259 | 392 | for source in sources: | 401 | for source in sources: |
260 | 393 | self.assertTupleEqual(('branch', source), parse_source(source)) | 402 | self.assertTupleEqual(('branch', source), parse_source(source)) |
261 | 394 | 403 | ||
262 | 404 | def test_url(self): | ||
263 | 405 | expected = ('url', 'http://example.com/gui') | ||
264 | 406 | self.assertTupleEqual( | ||
265 | 407 | expected, parse_source('url:http://example.com/gui')) | ||
266 | 408 | |||
267 | 409 | def test_file_url(self): | ||
268 | 410 | expected = ('url', 'file:///foo/bar') | ||
269 | 411 | self.assertTupleEqual(expected, parse_source('url:/foo/bar')) | ||
270 | 412 | |||
271 | 413 | def test_relative_file_url(self): | ||
272 | 414 | expected = ('url', 'file:///current/dir/foo/bar') | ||
273 | 415 | self.assertTupleEqual(expected, parse_source('url:foo/bar')) | ||
274 | 416 | |||
275 | 395 | 417 | ||
276 | 396 | class RenderToFileTest(unittest.TestCase): | 418 | class RenderToFileTest(unittest.TestCase): |
277 | 397 | 419 | ||
278 | @@ -539,9 +561,11 @@ | |||
279 | 539 | 561 | ||
280 | 540 | def test_start_gui(self): | 562 | def test_start_gui(self): |
281 | 541 | ssl_cert_path = '/tmp/certificates/' | 563 | ssl_cert_path = '/tmp/certificates/' |
282 | 564 | charmworld_url = 'http://charmworld.example' | ||
283 | 542 | start_gui( | 565 | start_gui( |
286 | 543 | False, 'This is login help.', True, True, ssl_cert_path, True, | 566 | False, 'This is login help.', True, True, ssl_cert_path, |
287 | 544 | haproxy_path='haproxy', config_js_path='config') | 567 | charmworld_url, True, haproxy_path='haproxy', |
288 | 568 | config_js_path='config') | ||
289 | 545 | haproxy_conf = self.files['haproxy'] | 569 | haproxy_conf = self.files['haproxy'] |
290 | 546 | self.assertIn('ca-base {0}'.format(ssl_cert_path), haproxy_conf) | 570 | self.assertIn('ca-base {0}'.format(ssl_cert_path), haproxy_conf) |
291 | 547 | self.assertIn('crt-base {0}'.format(ssl_cert_path), haproxy_conf) | 571 | self.assertIn('crt-base {0}'.format(ssl_cert_path), haproxy_conf) |
292 | @@ -558,6 +582,7 @@ | |||
293 | 558 | self.assertIn('readOnly: true', js_conf) | 582 | self.assertIn('readOnly: true', js_conf) |
294 | 559 | self.assertIn("socket_url: 'wss://", js_conf) | 583 | self.assertIn("socket_url: 'wss://", js_conf) |
295 | 560 | self.assertIn('socket_protocol: "wss"', js_conf) | 584 | self.assertIn('socket_protocol: "wss"', js_conf) |
296 | 585 | self.assertIn('charmworldURL: "http://charmworld.example"', js_conf) | ||
297 | 561 | apache_conf = self.files['juju-gui'] | 586 | apache_conf = self.files['juju-gui'] |
298 | 562 | self.assertIn('juju-gui/build-', apache_conf) | 587 | self.assertIn('juju-gui/build-', apache_conf) |
299 | 563 | self.assertIn('VirtualHost *:{0}'.format(WEB_PORT), apache_conf) | 588 | self.assertIn('VirtualHost *:{0}'.format(WEB_PORT), apache_conf) |
300 | @@ -565,9 +590,11 @@ | |||
301 | 565 | 590 | ||
302 | 566 | def test_start_gui_insecure(self): | 591 | def test_start_gui_insecure(self): |
303 | 567 | ssl_cert_path = '/tmp/certificates/' | 592 | ssl_cert_path = '/tmp/certificates/' |
304 | 593 | charmworld_url = 'http://charmworld.example' | ||
305 | 568 | start_gui( | 594 | start_gui( |
308 | 569 | False, 'This is login help.', True, True, ssl_cert_path, True, | 595 | False, 'This is login help.', True, True, ssl_cert_path, |
309 | 570 | haproxy_path='haproxy', config_js_path='config', secure=False) | 596 | charmworld_url, True, haproxy_path='haproxy', |
310 | 597 | config_js_path='config', secure=False) | ||
311 | 571 | js_conf = self.files['config'] | 598 | js_conf = self.files['config'] |
312 | 572 | self.assertIn("socket_url: 'ws://", js_conf) | 599 | self.assertIn("socket_url: 'ws://", js_conf) |
313 | 573 | self.assertIn('socket_protocol: "ws"', js_conf) | 600 | self.assertIn('socket_protocol: "ws"', js_conf) |
Please take a look.