apt: Use new format apt config when writing preserve_sources_list.
cloud-init reads the "preserve_sources_list" setting from 2 config paths:
old: top level apt_preserve_sources_list
new: apt/preserve_sources_list
Previously curtin would write only the old form. That lead to the
case where cloud-init would raise exception complaining about conflicting
settings and exiting error. That occurred because MAAS was incorrectly
sending 'preserve_sources_list: True'
The change here could result in actually causing that problem if:
A. a user was specifying old style 'apt_preserve_sources_list=False' in
user-data. They now have to match the version that curtin writes
but at least curtin is writing new format on new cloud-init.
B. MAAS provided differing setting in the curtin config 'debconf_selections'
That is because now the system will have format config specifying True
written by curtin and a different format written by user/maas.
I'd suggest the most likely chance for regression here would be
16.04+ systems with old MAAS (providing 'B') or JuJu providing 'A'.
In Cosmic some snaps are now seeded in the image and will
automatically install/mount at runtime. Overlayroot has
exposed a bug in snapd but prevents images from booting
completely. Workaround this issue (bug #1797218)
snapd and snapd.seeded services. A nice side-effect is that
those images with seeded snaps boot faster and use less
memory.
The elif clause when checking for tests via positional or filter
parameters never took the path where we invoked vmtest-filter.
Fix this by only pre-populating tests with 'tests/vmtests' if
there are no positional parameters and no filter parameters.
Also re-indent filter block to match program style.
distro: fix system_upgrade command using string instead of function
The distro system_upgrade configuration dictionary used a string
for the name of the function to call which resulted in attempting
to call a string type which failed. This was found in CI running
proposed upgrade testing.
The fix is to use the function name itself rather than string.
This branch also adds unittest for invoking the system_upgrade path.
Newer lxd (3.4+) 'file' command now produces progress info in some
cases written to stdout. This breaks curtin-from-container which
is invoked with the 'pack' curtin command which also writes to stdout.
The result was a corrupt curtin package output file which left all
vmtests sitting idle in the ephemeral boot phase and timing out.
To resolve, we capture stdout from lxc file push and report
the contents if file push fails.
vmtest: boot ephemeral with 'ro' on the kernel command line.
As raised in bug 1792905, when 'ro' is present in on the kernel command
line and the squashfs (rooturl=) parameter does not have a /lib/modules
then copymods fails to copy the modules into the "real root" and
things fail.
Maas is booting with 'ro', so it makes sense for curtin to do the same.
Additionally, 'ro' is present in almost all cases on a command line.
The bug is marked as fix-released (cosmic), and not fixed in bionic.
Our tests still fail in cosmic though, so kick this along while we figure
that out.