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

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 5213
Proposed branch: lp:~andreserl/maas/lp1592666
Merge into: lp:~maas-committers/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) Approve
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.
Revision history for this message
Gavin Panella (allenap) wrote :

Needs a test!

review: Needs Fixing
Revision history for this message
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'],