config: Account for multiple ID_LIKE words in os-release

The ID_LIKE tag that get_distro_id_base also queries may contain
multiple, space-separated values. Opensuse Leap 15.0 is exploiting that,
e.g. ("suse opensuse").

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2018-08-21 10:58:19 +02:00 committed by Daniel Wagner
parent e1cc66510c
commit 3744ff329a

View File

@ -51,19 +51,22 @@ class Context:
Sets the environment variables for process that are Sets the environment variables for process that are
started by kas. started by kas.
""" """
distro_base = get_distro_id_base().lower() self.environ = {}
if distro_base in ['fedora', 'suse', 'opensuse']: distro_bases = get_distro_id_base().lower().split()
self.environ = {'LC_ALL': 'en_US.utf8', for distro_base in distro_bases:
'LANG': 'en_US.utf8', if distro_base in ['fedora', 'suse', 'opensuse']:
'LANGUAGE': 'en_US'} self.environ = {'LC_ALL': 'en_US.utf8',
elif distro_base in ['debian', 'ubuntu', 'gentoo']: 'LANG': 'en_US.utf8',
self.environ = {'LC_ALL': 'en_US.UTF-8', 'LANGUAGE': 'en_US'}
'LANG': 'en_US.UTF-8', break
'LANGUAGE': 'en_US:en'} elif distro_base in ['debian', 'ubuntu', 'gentoo']:
else: self.environ = {'LC_ALL': 'en_US.UTF-8',
logging.warning('kas: "%s" is not a supported distro. ' 'LANG': 'en_US.UTF-8',
'No default locales set.', distro_base) 'LANGUAGE': 'en_US:en'}
self.environ = {} break
if self.environ == {}:
logging.warning('kas: No supported distros found in %s. '
'No default locales set.', distro_bases)
for key in ['http_proxy', 'https_proxy', 'ftp_proxy', 'no_proxy']: for key in ['http_proxy', 'https_proxy', 'ftp_proxy', 'no_proxy']:
val = os.environ.get(key, None) val = os.environ.get(key, None)