Merge ~lloydwaltersj/maas:ipv6-address-fail into maas:master

Proposed by Jack Lloyd-Walters
Status: Merged
Approved by: Jack Lloyd-Walters
Approved revision: b009bff52f997ec1aad74a90911972241099ab08
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~lloydwaltersj/maas:ipv6-address-fail
Merge into: maas:master
Diff against target: 35 lines (+8/-0)
2 files modified
src/maasserver/tests/test_vmhost.py (+2/-0)
src/maasserver/vmhost.py (+6/-0)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Anton Troyanov Approve
Review via email: mp+426005@code.launchpad.net

Commit message

Include extra sanitation for bracketless ipv6 in vmhost address

To post a comment you must log in.
Revision history for this message
Anton Troyanov (troyanov) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b ipv6-address-fail lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/13110/console
COMMIT: b009bff52f997ec1aad74a90911972241099ab08

review: Needs Fixing
Revision history for this message
Anton Troyanov (troyanov) wrote :

jenkins: !test

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b ipv6-address-fail lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: b009bff52f997ec1aad74a90911972241099ab08

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/tests/test_vmhost.py b/src/maasserver/tests/test_vmhost.py
index 408418d..cf9ea62 100644
--- a/src/maasserver/tests/test_vmhost.py
+++ b/src/maasserver/tests/test_vmhost.py
@@ -282,11 +282,13 @@ class TestCleanPowerAddress(MAASServerTestCase):
282 cases = [282 cases = [
283 ("10.0.0.1", "10.0.0.1:8443"),283 ("10.0.0.1", "10.0.0.1:8443"),
284 ("10.0.0.1:8443", "10.0.0.1:8443"),284 ("10.0.0.1:8443", "10.0.0.1:8443"),
285 ("2001:db8::1", "[2001:db8::1]:8443"),
285 ("[2001:db8::1]", "[2001:db8::1]:8443"),286 ("[2001:db8::1]", "[2001:db8::1]:8443"),
286 ("lxd-1", "lxd-1:8443"),287 ("lxd-1", "lxd-1:8443"),
287 ("lxd.cluster.com", "lxd.cluster.com:8443"),288 ("lxd.cluster.com", "lxd.cluster.com:8443"),
288 ("https://lxd-1", "lxd-1:8443"),289 ("https://lxd-1", "lxd-1:8443"),
289 ("https://lxd-1:8080", "lxd-1:8080"),290 ("https://lxd-1:8080", "lxd-1:8080"),
291 ("https://[2001:db8::1]", "[2001:db8::1]:8443"),
290 ("https://[2001:db8::1]:8080", "[2001:db8::1]:8080"),292 ("https://[2001:db8::1]:8080", "[2001:db8::1]:8080"),
291 ("qemu+ssh://10.0.0.1/system", "qemu+ssh://10.0.0.1/system"),293 ("qemu+ssh://10.0.0.1/system", "qemu+ssh://10.0.0.1/system"),
292 (294 (
diff --git a/src/maasserver/vmhost.py b/src/maasserver/vmhost.py
index 882e533..3c50f57 100644
--- a/src/maasserver/vmhost.py
+++ b/src/maasserver/vmhost.py
@@ -141,6 +141,12 @@ def _clean_power_address(vmhost_address):
141141
142 # urlparse() doesn't work if scheme is missing142 # urlparse() doesn't work if scheme is missing
143 if "://" not in vmhost_address:143 if "://" not in vmhost_address:
144 if (
145 vmhost_address.count(":") > 1
146 and "[" not in vmhost_address
147 and "]" not in vmhost_address
148 ):
149 vmhost_address = f"[{vmhost_address}]"
144 vmhost_address = f"{lxd_schemes[0]}://{vmhost_address}"150 vmhost_address = f"{lxd_schemes[0]}://{vmhost_address}"
145151
146 vmhost_url = urlparse(vmhost_address)152 vmhost_url = urlparse(vmhost_address)

Subscribers

People subscribed via source and target branches