Thus no HWADDR and the invalid field is generated :( It looks like the HWADDR line is a bit further down in the output. So ways to fix this:
1- change -A 2 to -A 4. This feels a bit brittle and if the ordering of fields changes again, we will experience the same problem.
2- Specify a device for which to obtain data, thus eliminating the possibility of multiple HWADDR fields (which I guess is why -A is being used to control the grep context). However this requires knowing the interface name. Something like this works :
nmcli -f GENERAL dev list iface wlan0 | awk '/HWADDR/ {print $2}'
However one simple fix suggested by cyphermox is that the mac-address field can be blank and things appear to work well. So I'll propose a "failsafe" where, if the MAC address is blank, that line won't get output to the config file.
OK, so it looks like create-connection was doing the right thing by trying to fetch the HWADDR field using this command:
nmcli -f GENERAL dev list | grep 802-11-wireless -A 2 | awk '/HWADDR/ {print $2}'
on Oneiric (sans the awk bit) it responds:
GENERAL.TYPE: 802-11-wireless
GENERAL.DRIVER: brcmsmac
GENERAL.HWADDR: 00:1B:B1:4C:90:F4
Note the HWADDR field.
However, on Precise it says:
GENERAL.TYPE: 802-11-wireless
GENERAL.VENDOR: Atheros Communications Inc.
GENERAL.PRODUCT: AR928X Wireless Network Adapter (PCI-Express)
Thus no HWADDR and the invalid field is generated :( It looks like the HWADDR line is a bit further down in the output. So ways to fix this:
1- change -A 2 to -A 4. This feels a bit brittle and if the ordering of fields changes again, we will experience the same problem.
2- Specify a device for which to obtain data, thus eliminating the possibility of multiple HWADDR fields (which I guess is why -A is being used to control the grep context). However this requires knowing the interface name. Something like this works :
nmcli -f GENERAL dev list iface wlan0 | awk '/HWADDR/ {print $2}'
However one simple fix suggested by cyphermox is that the mac-address field can be blank and things appear to work well. So I'll propose a "failsafe" where, if the MAC address is blank, that line won't get output to the config file.