Bug 1583582 - Mach should not depend on fields in /etc/os-release. r=kvark

Some fields of /etc/os-release are optional, so do not throw KeyError's when they're missing.

Differential Revision: https://phabricator.services.mozilla.com/D48984
This commit is contained in:
Kenny Levinsen committed 2019-10-11 19:27:14 +00:00
1 parent d60330c027
commit 11890702b9
1 file changed
+3 -3
+3 -3
View File
@@ -256,9 +256,9 @@ class Bootstrapper(object):
for line in open('/etc/os-release'):
k, v = line.rstrip().split("=")
d[k] = v.strip('"')
distro = d["NAME"]
version = d["VERSION_ID"]
dist_id = d["ID"]
distro = d.get("NAME")
version = d.get("VERSION_ID")
dist_id = d.get("ID")
if distro in ('CentOS', 'CentOS Linux', 'Fedora'):
cls = CentOSFedoraBootstrapper