netplan crashes when there is an empty origin hint file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
In Progress
|
Undecided
|
Lukas Märdian |
Bug Description
When there is an empty netplan origin hint file and one tries to write it will crash netplan:
qemu:ubuntu-
qemu:ubuntu-
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/
new_tree = self.merge(config, set_tree)
File "/usr/share/
if key in a:
TypeError: argument of type 'NoneType' is not iterable
Fwiw, the same seems to happen if the origin file does not exist and a subtree is unset (I can file a different bug for this). E.g.:
""" random- thing-not- on-disk network=null netplan" , line 23, in <module> netplan/ netplan/ cli/core. py", line 50, in main run_command( ) netplan/ netplan/ cli/utils. py", line 310, in run_command netplan/ netplan/ cli/commands/ set.py" , line 53, in run run_command( ) netplan/ netplan/ cli/utils. py", line 310, in run_command netplan/ netplan/ cli/commands/ set.py" , line 106, in command_set write_file( subtree, hint + '.yaml', self.root_dir) netplan/ netplan/ cli/commands/ set.py" , line 176, in write_file set_tree) )
# netplan set --origin-hint 90-some-
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/
raise Exception('Invalid input: {}'.format(
Exception: Invalid input: {'network': None}
"""