bootstrap.py: extract get_os_release_variable to make testing easier

This commit is contained in:
Erik Sundell
2023-06-06 23:29:53 +02:00
parent ecf11f0f27
commit 9e95961886

View File

@@ -183,12 +183,6 @@ def run_subprocess(cmd, *args, **kwargs):
return output
def ensure_host_system_can_install_tljh():
"""
Check if TLJH is installable in current host system and exit with a clear
error message otherwise.
"""
def get_os_release_variable(key):
"""
Return value for key from /etc/os-release
@@ -209,6 +203,12 @@ def ensure_host_system_can_install_tljh():
.strip()
)
def ensure_host_system_can_install_tljh():
"""
Check if TLJH is installable in current host system and exit with a clear
error message otherwise.
"""
# Require Ubuntu 20.04+ or Debian 11+
distro = get_os_release_variable("ID")
version = get_os_release_variable("VERSION_ID")