maas-enlist doesn't work when provided with serverurl with IPv6 address

Bug #1717287 reported by Witold Krecicki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Unassigned
2.2
Fix Released
High
Andres Rodriguez
maas-enlist (Ubuntu)
New
Undecided
Unassigned

Bug Description

There is a bug in parsing URLs that contain IPv6 addresses:
$ bash -x ./maas-enlist --serverurl http://[2001:db8::1]:5240/MAAS/api/2.0/machines/
(...)
+ wget -q -O/dev/null 'http://[2001:db8::1]:5240/http://[2001:db8::1]:5240/MAAS/api/2.0/machines/' '--post-data=op=new(...)'

Tags: internal

Related branches

Revision history for this message
Witold Krecicki (wpk) wrote :

The fix is a proper api_url regex:

--- maas-enlist~ 2017-09-14 17:24:38.000000000 +0200
+++ maas-enlist 2017-09-14 23:16:38.574202964 +0200
@@ -185,7 +185,7 @@
 if echo "$serverurl" | egrep -q '(^[a-z]+://|^)[a-z0-9\.]+($|/$)'; then
  api_url="MAAS/api/1.0/nodes/"
 else
- api_url=`echo $serverurl | sed 's#^\(\|[a-z]\+://\)[a-zA-Z0-9\.]\+\(\|\:[0-9]\+\)/##'`
+ api_url=`echo $serverurl | sed 's#^\(\|[a-z]\+://\)\([a-zA-Z0-9\.]\+\|\(\[[0-9a-fA-F:]\+\]\)\)\(\|\:[0-9]\+\)/##'`
 fi

 #TODO: Auto-detect hostname?

Changed in maas:
milestone: none → 2.3.0
tags: added: internal
Changed in maas:
status: New → Fix Committed
Changed in maas:
importance: Undecided → High
Revision history for this message
Witold Krecicki (wpk) wrote :

Could this fix be backported to current releases too?

Changed in maas:
milestone: 2.3.0 → 2.3.0beta1
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.