Merge lp:~andreserl/maas/lp1592666 into lp:maas/trunk

Proposed by Andres Rodriguez on 2016-07-28
Status: Merged
Approved by: Andres Rodriguez on 2016-07-28
Approved revision: 5209
Merged at revision: 5213
Proposed branch: lp:~andreserl/maas/lp1592666
Merge into: lp:maas/trunk
Diff against target: 46 lines (+8/-8)
2 files modified
src/maasserver/preseed.py (+1/-1)
src/maasserver/tests/test_preseed.py (+7/-7)
To merge this branch: bzr merge lp:~andreserl/maas/lp1592666
Reviewer Review Type Date Requested Status
Gavin Panella (community) 2016-07-28 Approve on 2016-07-28
Review via email: mp+301350@code.launchpad.net

Commit message

Strip forward slash in the path of the archive mirror, provided that when composing the whole archive, we add the additional "/".

To post a comment you must log in.
Gavin Panella (allenap) wrote :

Needs a test!

review: Needs Fixing
lp:~andreserl/maas/lp1592666 updated on 2016-07-28
5209. By Andres Rodriguez on 2016-07-28

Address Gavin's comments, and push tests

Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/preseed.py'
2--- src/maasserver/preseed.py 2016-07-06 05:37:58 +0000
3+++ src/maasserver/preseed.py 2016-07-28 14:06:19 +0000
4@@ -573,7 +573,7 @@
5 and, optionally, the port.
6 """
7 parsed_url = urlparse(url)
8- return parsed_url.netloc, parsed_url.path
9+ return parsed_url.netloc, parsed_url.path.lstrip("/")
10
11
12 def get_preseed_context(osystem='', release='', rack_controller=None):
13
14=== modified file 'src/maasserver/tests/test_preseed.py'
15--- src/maasserver/tests/test_preseed.py 2016-07-06 05:37:58 +0000
16+++ src/maasserver/tests/test_preseed.py 2016-07-28 14:06:19 +0000
17@@ -123,12 +123,12 @@
18
19 def test_get_netloc_and_path(self):
20 input_and_results = [
21- ('http://name.domain:66/my/path', ('name.domain:66', '/my/path')),
22- ('http://name.domain:80/my/path', ('name.domain:80', '/my/path')),
23- ('http://name.domain/my/path', ('name.domain', '/my/path')),
24- ('https://domain/path', ('domain', '/path')),
25+ ('http://name.domain:66/my/path', ('name.domain:66', 'my/path')),
26+ ('http://name.domain:80/my/path', ('name.domain:80', 'my/path')),
27+ ('http://name.domain/my/path', ('name.domain', 'my/path')),
28+ ('https://domain/path', ('domain', 'path')),
29 ('http://domain:12', ('domain:12', '')),
30- ('http://domain/', ('domain', '/')),
31+ ('http://domain/', ('domain', '')),
32 ('http://domain', ('domain', '')),
33 ]
34 inputs = [input for input, _ in input_and_results]
35@@ -446,9 +446,9 @@
36 self.assertEqual(
37 (
38 parsed_main_archive.hostname,
39- parsed_main_archive.path,
40+ parsed_main_archive.path.lstrip('/'),
41 parsed_ports_archive.hostname,
42- parsed_ports_archive.path,
43+ parsed_ports_archive.path.lstrip('/'),
44 ),
45 (
46 context['main_archive_hostname'],