mac address parsing fails on specific mac addressess
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Triaged
|
Medium
|
Unassigned |
Bug Description
config snippet:
ens8:
match:
when trying netplan try with this specific mac address I get an error(see bellow)
fortunately I was able to get a different mac address for the vm which did work with everything else in the config the same, but it seems mac address containing only numbers are parsed as a number instead of a string?
root@ubuntu:~# netplan try
Warning: Stopping systemd-
systemd-
An error occurred: 'int' object has no attribute 'lower'
Reverting.
Warning: Stopping systemd-
systemd-
Traceback (most recent call last):
File "/usr/share/
NetplanAppl
File "/usr/share/
changes = NetplanApply.
File "/usr/share/
current_
File "/usr/share/
matches = list(filter(lambda iface: is_interface_
File "/usr/share/
matches = list(filter(lambda iface: is_interface_
File "/usr/share/
return match_mac.lower() == macaddress.lower()
AttributeError: 'int' object has no attribute 'lower'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/sbin/
netplan.main()
File "/usr/share/
self.
File "/usr/share/
self.func()
File "/usr/share/
self.
File "/usr/share/
self.func()
File "/usr/share/
self.revert()
File "/usr/share/
NetplanAppl
File "/usr/share/
changes = NetplanApply.
File "/usr/share/
current_
File "/usr/share/
matches = list(filter(lambda iface: is_interface_
File "/usr/share/
matches = list(filter(lambda iface: is_interface_
File "/usr/share/
return match_mac.lower() == macaddress.lower()
AttributeError: 'int' object has no attribute 'lower'
Changed in netplan: | |
status: | New → Confirmed |
status: | Confirmed → Triaged |
Netplan's configmanager.py uses a python YAML parser, which interpret MAC addresses, consisting of numbers only as integer, e.g.:
>>> import yaml load('52: 54:00:26: 30:21')
>>> yaml.safe_
41135135421
Please make sure to quote your value (i.e. macaddress: '52:54: 00:26:30: 21') to have it interpreted as a string.
The netplan CLI will eventually transition to another YAML parser (from libnetplan), which will do more specific input validation and will better handle situations like this.