From cd9ecd22570d7ec9f4076e645aa4072bb58f6e18 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 10 Jul 2020 10:45:03 -0700 Subject: [PATCH] added redhat like os to invoke task --- tasks.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks.py b/tasks.py index 05f23d5f..272db1df 100644 --- a/tasks.py +++ b/tasks.py @@ -16,13 +16,14 @@ class OsName(Enum): class OsLike(Enum): DEBIAN = "debian" + REDHAT = "rhel fedora" class OsInfo: - def __init__(self, name: OsName, like: OsLike, version: str) -> None: + def __init__(self, name: OsName, like: OsLike, version: float) -> None: self.name: OsName = name self.like: OsLike = like - self.version: str = version + self.version: float = version def get_python(c: Context) -> str: @@ -48,13 +49,16 @@ def get_os() -> OsInfo: d[key] = value.strip('"') name_value = d["ID"] like_value = d["ID_LIKE"] + version_value = d["VERSION_ID"] try: name = OsName(name_value) like = OsLike(like_value) + version = float(version_value) except ValueError: - print(f"unsupported os({name_value}) like({like_value})") + print( + f"unsupported os({name_value}) like({like_value}) version({version_value}" + ) sys.exit(1) - version = d["VERSION_ID"] return OsInfo(name, like, version)