pserv.yaml rewrite breaks when previous generator URL uses IPv6 address

Bug #1373261 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Jeroen T. Vermeulen
maas (Ubuntu)
Fix Committed
Undecided
Jeroen T. Vermeulen

Bug Description

Reconfiguring when the previous MAAS_URL used an IPv6 host address broke the ‘generator’ setting in my pserv.yaml: it ended up being the full newly configured netloc, with most of the previous IPv6 netloc tacked onto it.

I think that's because the regex in maas-cluster-controller.postinst mistakes the first colon in an IPv6 address for the beginning of a port specifier:

        sed -i "s|MAAS_URL=.*|MAAS_URL=\"$RET\"|" /etc/maas/maas_cluster.conf
        # Extract the hostname part.
        HOSTPART=$(echo $RET|awk '{ split($0,array,"/")} END{print array[3] }')
        # And substitute it in-place in pserv.yaml on an indented, non-commented
        # line.
        sed -ri "s|^([[:space:]]+)(#+[[:space:]]*)?(generator:[[:space:]]+https?://)[^:/]+|\1\3$HOSTPART|" /etc/maas/pserv.yaml

These things are still best done in Python I suppose.

Tags: ipv6 packaging

Related branches

tags: added: packaging
Revision history for this message
Graham Binns (gmb) wrote :

Another packaging one for you, Andres.

Changed in maas:
assignee: nobody → Andres Rodriguez (andreserl)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Let's target it properly then.

Changed in maas:
status: Triaged → Invalid
Changed in maas:
milestone: 1.7.0 → none
Revision history for this message
Christian Reis (kiko) wrote :

Andres, can you assign this one to yourself?

Changed in maas:
milestone: none → 1.7.0
Gavin Panella (allenap)
Changed in maas:
assignee: Andres Rodriguez (andreserl) → Gavin Panella (allenap)
Changed in maas (Ubuntu):
assignee: nobody → Gavin Panella (allenap)
Changed in maas:
assignee: Gavin Panella (allenap) → nobody
Changed in maas (Ubuntu):
status: New → Confirmed
Christian Reis (kiko)
Changed in maas:
status: Invalid → Triaged
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Kiko, this is not a maas bug, it's a packaging bug, for which bugs are targeted to the ubuntu task.

Revision history for this message
Christian Reis (kiko) wrote :

The problem is that I need to leave them triaged or I miss them in the milestone list.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Jeroen,

Can you please provide what ends up in pserv.yaml?

Graham Binns (gmb)
Changed in maas:
assignee: nobody → Graham Binns (gmb)
Graham Binns (gmb)
Changed in maas:
status: Triaged → In Progress
Changed in maas (Ubuntu):
assignee: Gavin Panella (allenap) → nobody
Revision history for this message
Graham Binns (gmb) wrote :

I can't reproduce this locally; it seems to work fine with properly formatted — and even improperly formatted — IPv6 addresses. We really need to see the problem you're seeing Jeroen.

Changed in maas:
status: In Progress → Incomplete
Christian Reis (kiko)
Changed in maas:
milestone: 1.7.0 → next
assignee: Graham Binns (gmb) → Jeroen T. Vermeulen (jtv)
Christian Reis (kiko)
Changed in maas:
milestone: next → 1.7.1
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The problem is still there. Example:

My pserv.yaml contains...

  generator: http://[fdd1:caf5:2922:8b1f::1]/MAAS/api/1.0/pxeconfig/

Now, realising that this doesn't work, I run ‘dpkg-reconfigure maas-cluster-controller’ and set the MAAS URL to “http://10.9.9.1/MAAS”.

The resulting pserv.yaml now contains...

  generator: http://10.9.9.1:caf5:2922:8b1f::1]/MAAS/api/1.0/pxeconfig/

Note how the first part of the netloc, up to the first colon, is replaced with the new address — but the rest of the netloc is still there.

Changed in maas:
assignee: Jeroen T. Vermeulen (jtv) → nobody
status: Incomplete → Triaged
Revision history for this message
Graham Binns (gmb) wrote : Re: [Bug 1373261] Re: pserv.yaml rewrite breaks when MAAS URL uses IPv6 address

On 5 November 2014 11:23, Jeroen T. Vermeulen
<email address hidden> wrote:
>
> Note how the first part of the netloc, up to the first colon, is
> replaced with the new address — but the rest of the netloc is still
> there.

Ah, now ISWYM. Sorry, I'd missed that the *existing* MAAS URL in
pserv.yaml was an IPv6 address. Thanks for clarification.

description: updated
summary: - pserv.yaml rewrite breaks when MAAS URL uses IPv6 address
+ pserv.yaml rewrite breaks when previous generator URL uses IPv6 address
description: updated
Changed in maas:
assignee: nobody → Jeroen T. Vermeulen (jtv)
status: Triaged → In Progress
Changed in maas (Ubuntu):
assignee: nobody → Jeroen T. Vermeulen (jtv)
status: Confirmed → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas (Ubuntu):
status: In Progress → Fix Committed
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.