cloud-init fails if no network config is set
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
cloud-init version: 0.7.9-90-
Ubuntu version: 16.04 LTS
On a pristine install cloud-init fails in every stage on startup with the following error:
Traceback (most recent call last):
File "/usr/lib/
ret = functor(name, args)
File "/usr/lib/
init.
File "/usr/lib/
return self.distro.
File "/usr/lib/
dev_names = self._write_
File "/usr/lib/
return self._supported
File "/usr/lib/
renderer.
File "/usr/lib/
network_
File "/usr/lib/
util.
File "/usr/lib/
for iface in network_
AttributeError: 'NoneType' object has no attribute 'iter_interfaces'
This leads to the instance not being provisioned at all.
Looking through the code the following change seems to be the origin: https:/
At this point there is a check if both 'version' and 'config' are True. By default no network config is set and the 'net_config' parameter passed here in 'parse_
Suggested fix:
1. Change the check of 'config' to explicitly test for None (if version and config is not None) which would restore the intended semantics of parsing the empty list (and therefore returning the empty NetworkState).
2. Add an explicit check to the renderer(s) to check if the network_state is None and skip the rendering in this case (maybe emit a warning).
I could prepare a fix if you let me know where and how to submit a PR.
Hi, Bernd Stolle --
A patch is certainly welcome, the code is here:
https:/ /code.launchpad .net/cloud- init
Once you clone and fix, you can push up a branch to your repository on launchpad. Once you do that, you can open a "merge proposal" by viewing the branch in the LP UI, choosing'master' as the reference to merge into.
Give it a shot, and ask us any questions in #cloud-init on freenode.