def get_os_release_variable()

in application-workloads/jupyter/jupyterhub-classroom/scripts/bootstrap.py [0:0]


def get_os_release_variable(key):
    """
    Return value for key from /etc/os-release
    /etc/os-release is a bash file, so should use bash to parse it.
    Returns empty string if key is not found.
    """
    return subprocess.check_output([
        '/bin/bash', '-c',
        "source /etc/os-release && echo ${{{key}}}".format(key=key)
    ]).decode().strip()