Aggregated duplicate runtime os checking functions into one.

This commit is contained in:
VakarisZ 2021-05-26 16:45:51 +03:00
parent f5f8f572f6
commit f7674b0635
3 changed files with 4 additions and 15 deletions

View File

@ -1,5 +1,5 @@
import sys
import platform
def is_windows_os() -> bool:
return sys.platform.startswith("win")
return platform.system() == "Windows"

View File

@ -1,11 +0,0 @@
import platform
WINDOWS = "Windows"
LINUX = "Linux"
def get_runtime_os() -> str:
if platform.system() == "Windows":
return WINDOWS
else:
return LINUX

View File

@ -3,7 +3,7 @@ import os
import subprocess
from typing import List
from monkey_island.cc.server_utils.common_methods import WINDOWS, get_runtime_os
from monkey_island.cc.environment.utils import is_windows_os
from monkey_island.cc.server_utils.consts import (
MONGO_EXECUTABLE_PATH_LINUX,
MONGO_EXECUTABLE_PATH_WIN,
@ -53,7 +53,7 @@ class MongoDbRunner:
@staticmethod
def _get_path_of_mongo_exec():
if get_runtime_os() == WINDOWS:
if is_windows_os():
return MONGO_EXECUTABLE_PATH_WIN
else:
return MONGO_EXECUTABLE_PATH_LINUX