def _is_at_least_ubuntu22()

in azure-slurm-install/install.py [0:0]


def _is_at_least_ubuntu22() -> bool:
    if not os.path.exists("/etc/os-release"):
        return False
    lsb_rel = {}
    with open("/etc/os-release") as fr:
        for line in fr:
            line = line.strip()
            if not line:
                continue
            if "=" not in line:
                continue
            key, val = line.split("=", 1)
            lsb_rel[key.strip().upper()] = val.strip('"').strip().lower()

    if lsb_rel.get("ID") == "ubuntu" and lsb_rel.get("VERSION_ID", "") >= "22.04":
        return True
    
    return False