Comment 0 for bug 1373261

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote : pserv.yaml rewrite breaks when MAAS URL uses IPv6 address

Reconfiguring between an IPv4-based and an IPv6-based MAAS_URL broke the ‘generator’ setting in my pserv.yaml: it ended up being the full IPv4 netloc, with most of the 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.