Fix up invalid locales in the login environment; don't print warning messages.
Invalid locales in the environment at login (e.g. as provided by ssh
SendEnv from a client system which has a different set of available locales
than the server) currently result in a large warning message (once, per
login user, per instance) and a broken environment.
On Ubuntu systems, and probably others, this broken environment results in
wrong runtime behavior vs if no locale had been passed at all by the client;
in particular, Ubuntu systems will give UTF-8 as a character set by default
(either the en_US.UTF-8 or C.UTF-8 locale, depending on the version of
Ubuntu), and if an invalid locale is specified, the login instead will use
ASCII as the only supported character set.
This change reworks cloud-init's profile handling to:
- fix up any invalid locale settings detected in the environment, so that
the login session does not unnecessarily lose non-ascii character support
due to a requested missing locale
- remove the warning message, which is of disputed value.
This approximates the OpenSSH upstream guidance regarding a correct design
for this in OpenSSH itself, as described at
<https://bugzilla.mindrot.org/show_bug.cgi?id=1346#c38>, but will work on
all systems which do not have an ssh client+server that implement that does
not implement this proposed design (i.e.: all clients and servers currently
in existence).
Fix get_proc_env for pids that have non-utf8 content in environment.
There is no requirement that the environment of a process contains
only utf-8 data. This modifies get_proc_env to support it reading
data as binary and decoding if provided with an encoding.
The default case is now that we now do:
contents.decode('utf-8', 'replace')
rather than
contents.decode('utf-8', 'strict')
tests: fix salt_minion integration test on bionic and later
In ubuntu, the salt-minion package version 2017.7.4+dfsg1-1 or later
automatically moves any seed keys from /etc/salt/pki/minion/ to
/var/lib/salt/pki/minion/. Fix integration tests to collect
either files in either /etc/salt/pki/minion/ or
/var/lib/salt/pki/minion/.
tests: provide human-readable integration test summary when --verbose
Integration tests will now provide a brief summary for test failures
listed by platform and distribution. The failure summary will only consist
of failed test name and assert error message.
Drop the verbose dictionary of all integration test output because this
content is unreadable given the large number of integration test results
listed within this dictionary.
tests: skip chrony integration tests on lxd running artful or older
A fix for chrony support per LP: #1589780 is not expected in Artful or
older series. Skip the chrony suite of tests when running on a container
and ubuntu series represented is <= artful as errors are expected.
test: add optional --preserve-instance arg to integraiton tests
By default, integration tests destroy the test instances after each
test run. To aid debug and development of integration tests, support a
--preserve-instance argument which will leave the modified test instance
in a stopped state for further debug.
netplan: fix mtu if provided by network config for all rendered types
When network configuration for any interface defines maximum transmission
values (MTU) the netplan, eni and sysconfig renders will take into account
any device-level, or subnet-level mtu values.
When network configuration has conflicting device-level and ipv4 subnet
mtu values, the subnet-specific value is honored and a warning will be
logged about any ignored device-level setting.
This adds 'combine_capture' argument as was present in curtin's
subp. It is useful to get interleaved output of a command. I noticed
a need for it when looking at user_data_rhevm in DataSourceAltCloud.
That will run a subcommand, logging its stdout but swallowing its stderr.
Another thing to change to use this would be in udevadm_settle which
currently just returns the subp() call.
Also, add the docstring copied from curtin's subp.