ipv6_ready referenced before assignment
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| cloud-init |
Fix Released
|
High
|
Andrew Kutz | ||
Bug Description
cloud-init crashes due to reference ipv6_ready before assignment.
cloud-init version: 22.2.2-1.ph3
traceback in cloudinit/
[2022年08月15日 17:38:14] 2022年08月15日 17:38:14,682 - util.py[WARNING]: failed stage init
[2022年08月15日 17:38:14] failed run of stage init
[2022年08月15日 17:38:14] -------
[2022年08月15日 17:38:14] Traceback (most recent call last):
[2022年08月15日 17:38:14] File "/usr/lib/
[2022年08月15日 17:38:14] ret = functor(name, args)
[2022年08月15日 17:38:14] File "/usr/lib/
[2022年08月15日 17:38:14] init.setup_
[2022年08月15日 17:38:14] File "/usr/lib/
[2022年08月15日 17:38:14] self.datasource
[2022年08月15日 17:38:14] File "/usr/lib/
[2022年08月15日 17:38:14] host_info = wait_on_
[2022年08月15日 17:38:14] File "/usr/lib/
[2022年08月15日 17:38:14] ipv6_ready,
[2022年08月15日 17:38:14] UnboundLocalError: local variable 'ipv6_ready' referenced before assignment
There is an issue in the source code: under certain conditions, ipv6_ready may be referenced in LOG.debug() before assignment if wait_on_ipv6 = false. The same issue may also happen for ipv4_ready if wait_on_ipv4 = false.
host_info = None
while host_info is None:
# This loop + sleep results in two logs every second while waiting
# for either ipv4 or ipv6 up. Do we really need to log each iteration
# or can we log once and log on successful exit?
host_info = get_host_info()
network = host_info.
interfaces = network.
by_ipv4 = interfaces.
by_ipv6 = interfaces.
if wait_on_ipv4:
if not ipv4_ready:
if wait_on_ipv6:
if not ipv6_ready:
if host_info is None:
)
Opened PR to fix the issue -- https:/
Thanks Andrew for the upstream commit here.
https:/
This will be in cloud-init the next cloud-init SRU of 22.3-X which should also make it into Ubuntu Bionic, Focal and Jammy in the next 2 weeks.
I realize this doesn't help Photon OS, but wanted to provide a reference in case this hits Ubuntu consumers too.
Tracked in Github Issues as https:/