provision: Don't install lsb-release if already installed.

This early bootstrapping step should be rearely required, and it saves
about 0.5s in our no-op provision time.
This commit is contained in:
Tim Abbott
2018-05-20 14:15:40 -07:00
parent 9be3c704f1
commit 235002a549

View File

@@ -99,7 +99,9 @@ else:
# Ideally we wouldn't need to install a dependency here, before we
# know the codename.
subprocess.check_call(["sudo", "apt-get", "install", "-y", "lsb-release"])
if not os.path.exists("/usr/bin/lsb_release"):
subprocess.check_call(["sudo", "apt-get", "install", "-y", "lsb-release"])
vendor = subprocess_text_output(["lsb_release", "-is"])
codename = subprocess_text_output(["lsb_release", "-cs"])
if not (vendor in SUPPORTED_PLATFORMS and codename in SUPPORTED_PLATFORMS[vendor]):