Comment 74 for bug 1770082

Revision history for this message
Marcos (markinholiveira) wrote :

Actually, sent the wrong patch... this is the right one:

root@netplan:~# cat fix-bug-1770082.diff
--- a/netplan/cli/commands/apply.py
+++ b/netplan/cli/commands/apply.py
@@ -170,15 +170,15 @@
             link = netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]
             macaddress = link.get('addr')
             if driver_name in matches['by-driver']:
- new_name = matches['by-driver'][driver_name]
- logging.debug(new_name)
+ current_name = matches['by-driver'][driver_name]
+ logging.debug(current_name)
                 logging.debug(interface)
- if new_name != interface:
- changes.update({interface: {'name': new_name}})
+ if current_name != newname:
+ changes.update({interface: {'name': newname}})
             if macaddress in matches['by-mac']:
- new_name = matches['by-mac'][macaddress]
- if new_name != interface:
- changes.update({interface: {'name': new_name}})
+ current_name = matches['by-mac'][macaddress]
+ if current_name != newname:
+ changes.update({interface: {'name': newname}})

         logging.debug(changes)
         return changes