Comment 2 for bug 2009006

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Hi Leonardo,

The Netplan's parser went through a major refactoring between versions 0.104 and 0.105. That's probably what caused the behavioral change you've found.

I believe that what is not very clear is what the expected outcome of "netplan set" is. Netplan naturally merges the configuration when the same interface is defined in two different places. So when you introduce a new IP address with netplan set, as I understand, it should add it to the existing list of IPs. That said, the new behavior seems to be correct.

Now, it should do the same for routes. It is a bug that was already fixed [0] in Netplan 0.106 (available only in Lunar at the moment).

If you want to overwrite the old entries you need to do something like this:

netplan set "network.ethernets.ens160.routes=null"

And then add the new route.

Regarding the extra quotes, that's unfortunate it will add them when you didn't use them yourself. But I don't expect it to break YAML parsers out there because it's part of the YAML specification [1].

I think the next steps here are 1) update netplan-set(8) to make it clear what the expected behavior of "netplan set" is; and 2) think about back-porting [0] to Netplan 0.105 so it will behave as expected when updating routes.

[0] - https://github.com/canonical/netplan/pull/320
[1] - https://yaml.org/spec/1.1/#id858081