Package: cloud-init
Version: 20.2-2~deb10u1
Severity: normal

Dear Maintainer,

after switching from the Debian cloud image 
"debian-10-generic-amd64-daily-20200510-259.qcow2" to the newer 
"debian-10-generic-amd64-daily-20200803-347.qcow2" we noticed some automated 
builds using cloud-init failing.
The exact message printed in /var/log/cloud-init.log is as follows:

2020-08-04 13:10:01,614 - util.py[DEBUG]: Running module apt-configure (<module 
'cloudinit.config.cc_apt_configure' from 
'/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 849, in 
_run_modules
    freq=freq)
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", 
line 274, in handle
    ocfg = convert_to_v3_apt_format(ocfg)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", 
line 761, in convert_to_v3_apt_format
    cfg = convert_v2_to_v3_apt_format(cfg)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", 
line 727, in convert_v2_to_v3_apt_format
    oldkey))
ValueError: Old and New apt format defined with unequal values True vs False @ 
apt_preserve_sources_list

In our configuration we override APT mirrors with local adresses as outlined in 
the cloud-init documentation which has worked fine in the past:

[...]
# cc_apt_configure
apt:
    preserve_sources_list: false
[...]

After some research it seems that a change made a while ago might be 
responsible for this behaviour: 
https://salsa.debian.org/cloud-team/cloud-init/-/commit/2e56b3a489e840c670db4c89633a49ad3374deed

It might be required to specify the default using the newer syntax as 
"apt_preserve_sources_list" seems to be an outdated way of defining the 
configuration key according the upstream code:
https://github.com/canonical/cloud-init/blob/3c551f6ebc12f7729a2755c89b19b9000e27cc88/cloudinit/config/cc_apt_configure.py#L840


Regards,
Michael Guschlbauer

Reply via email to