so the bug here is actually in 'get_default_route_ip' of the postinst for maas-region-controller-min and maas-region-controller.
They run with 'set -e' (which i'm never a fan of), and then have:
get_default_route_ip() {
while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do [ "$Mask" = "00000000" ] && break
done < /proc/net/route
interface="$Iface"
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
ipaddr=${ipaddr#* inet }
ipaddr=${ipaddr%%/*}
echo $ipaddr
}
That method has many issues.
a.) will stomp over global variables 'iface' 'Destination' Gateway, Flags .... and 'interface'. luckily it is only run in a subshell, so thats not really a problem here.
b.) if interface is empty it runs : ip -4 addr list dev "" scope global
ip fails, thus the method fails, and thus the dpkg postinst fails (thanks to set -e).
the simpllist fix is just to add:
[ -n "$interface" ] || return 0
so the bug here is actually in 'get_default_ route_ip' of the postinst for maas-region- controller- min and maas-region- controller.
They run with 'set -e' (which i'm never a fan of), and then have:
get_default_ route_ip( ) { "$Iface" $(LC_ALL= C /sbin/ip -4 addr list dev "$interface" scope global) ${ipaddr# * inet } ${ipaddr% %/*}
while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do [ "$Mask" = "00000000" ] && break
done < /proc/net/route
interface=
ipaddr=
ipaddr=
ipaddr=
echo $ipaddr
}
That method has many issues.
a.) will stomp over global variables 'iface' 'Destination' Gateway, Flags .... and 'interface'. luckily it is only run in a subshell, so thats not really a problem here.
b.) if interface is empty it runs : ip -4 addr list dev "" scope global
ip fails, thus the method fails, and thus the dpkg postinst fails (thanks to set -e).
the simpllist fix is just to add:
[ -n "$interface" ] || return 0
right after the loop that reads /proc/net/route.