Netplan generates the wrong YAML value when setting activation-mode=off
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan.io (Ubuntu) |
Triaged
|
Low
|
Unassigned | ||
Focal |
Triaged
|
Low
|
Unassigned | ||
Impish |
Triaged
|
Low
|
Unassigned | ||
Jammy |
Triaged
|
Low
|
Unassigned | ||
Kinetic |
Triaged
|
Low
|
Unassigned |
Bug Description
When setting activation-mode=off on Ubuntu 20.04/Ubuntu Core 20, netplan generates the incorrect value in the YAML file (activation-mode: false), causing it to fail due to incorrect syntax.
$ sudo netplan set ethernets.
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.
File "/usr/share/
libnetplan.
File "/usr/share/
raise Exception(
Exception: /tmp/netplan-
activatio
description: | updated |
Changed in netplan.io (Ubuntu Kinetic): | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in netplan.io (Ubuntu Focal): | |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: rls-ff-incoming rls-kk-incoming |
tags: | added: fr-2415 |
tags: | removed: rls-ff-incoming rls-kk-incoming |
Changed in netplan.io (Ubuntu Impish): | |
importance: | Undecided → Low |
Changed in netplan.io (Ubuntu Jammy): | |
importance: | Undecided → Low |
Changed in netplan.io (Ubuntu Impish): | |
status: | New → Triaged |
Changed in netplan.io (Ubuntu Jammy): | |
status: | New → Triaged |
This seems to be due to the (old) Python YAML parser being in conflict with libnetplan's actual C YAML parser.
Apparently pyyaml interprets "off" as a boolean ('False') by default in yaml.safe_load(value) (`set_tree = self.parse_key(key, yaml.safe_load(value))`), while it is supposed to be an actual string ("off") for activation-mode.
Looks like it was broken ever since netplan set was introduced (v0.101) and just recently got fixed via https://github.com/canonical/netplan/pull/254 (https://github.com/canonical/netplan/commit/bdb4f9846c8f40275c09a28bed04d8436cbbeffc to be specific)