cloud-init devel net-convert crash when --debug is enabled
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| cloud-init |
Fix Released
|
High
|
Chad Smith | ||
Bug Description
Since 22.2 enabling "--debug" for "cloud-init devel net-convert" will make cloud-init crash.
Probably linked to 3e5938c6ae22b9f
Stack trace shows:
Traceback (most recent call last):
File "/xyz/git/
sys.
File "/xyz/git/
retval = util.log_time(
File "/xyz/git/
ret = func(*args, **kwargs)
File "/xyz/git/
"\n".join(["", "Internal State", safeyaml.dumps(ns, noalias=True), ""])
File "/xyz/git/
return yaml.dump(
File "/xyz/git/
return dump_all([data], stream, Dumper=Dumper, **kwds)
File "/xyz/git/
dumper.
File "/xyz/git/
node = self.represent_
File "/xyz/git/
node = self.yaml_
File "/xyz/git/
raise RepresenterErro
yaml.represente
i tried to replace to dumper with the unsafe version and it was working again
Thank you for this bug and making cloud-init better and for the additional commit reference as a guess for when regression was introduced.
You are correct that I reintroduced SafeDumper default and that's what broke the cloud-init devel net-convert command.
Because the original commit cf30836645473c6
Turns out, the command `cloud-init devel net-convert --debug` does attempt to stuff in a python object as you noted NetworkState.
I have reviewed all runtime call-sites to cloudinit.
Here is an upstream PR to fix this one callsite and add a unit test so we recognize this type of failure in the future. https:/
Thank you for the quick answer! I tried with your patch, and it looks good. Thx!
(quick test for info)
$ git logo -1
610d1138 (HEAD, chad/net-convert) net-convert: use yaml.dump for debugging python NetworkState obj
[May 30 09:34AM] 0m0s
~/git/cloud-init ((HEAD detached at chad/net-convert)) :)
$ cloud-init devel net-convert --debug -p/tmp/
(...)
ok
Thanks for the test here Benjamin upstream commit landed with this fix. It will be included in cloud-init upstream version 22.3.
https:/
This bug is believed to be fixed in cloud-init in version 22.3. If this is still a problem for you, please make a comment and set the state back to New
Thank you.
Tracked in Github Issues as https:/