Bug 1583582 - Mach should not depend on fields in /etc/os-release. r=kvark
authorKenny Levinsen <kl@kl.wtf>
Fri, 11 Oct 2019 19:27:14 +0000
changeset 497360 b4e9b21cd886e4d22997ff24abf941d363f5bfb5
parent 497359 9d2586266fcd94d61cf0576c41b2f9b7351ae077
child 497361 1411bb191e69e717fe5d2309be5a6e4f69cf7b16
push id97834
push usersledru@mozilla.com
push dateSat, 12 Oct 2019 09:03:59 +0000
treeherderautoland@b4e9b21cd886 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskvark
bugs1583582
milestone71.0a1
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
python/mozboot/mozboot/bootstrap.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -251,19 +251,19 @@ class Bootstrapper(object):
             distro, version, dist_id = platform.linux_distribution()
 
             # Read the standard `os-release` configuration
             if distro == '' and os.path.exists('/etc/os-release'):
                 d = {}
                 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
                 args['distro'] = distro
             elif distro in DEBIAN_DISTROS:
                 cls = DebianBootstrapper
                 args['distro'] = distro
             elif distro in ('Gentoo Base System', 'Funtoo Linux - baselayout '):