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:
)
Changed in cloud-init: | |
status: | Fix Committed → Fix Released |
Opened PR to fix the issue -- https:/ /github. com/canonical/ cloud-init/ pull/1674