forked from p15670423/monkey
Aggregated duplicate runtime os checking functions into one.
This commit is contained in:
parent
f5f8f572f6
commit
f7674b0635
|
@ -1,5 +1,5 @@
|
||||||
import sys
|
import platform
|
||||||
|
|
||||||
|
|
||||||
def is_windows_os() -> bool:
|
def is_windows_os() -> bool:
|
||||||
return sys.platform.startswith("win")
|
return platform.system() == "Windows"
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import platform
|
|
||||||
|
|
||||||
WINDOWS = "Windows"
|
|
||||||
LINUX = "Linux"
|
|
||||||
|
|
||||||
|
|
||||||
def get_runtime_os() -> str:
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
return WINDOWS
|
|
||||||
else:
|
|
||||||
return LINUX
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import List
|
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 (
|
from monkey_island.cc.server_utils.consts import (
|
||||||
MONGO_EXECUTABLE_PATH_LINUX,
|
MONGO_EXECUTABLE_PATH_LINUX,
|
||||||
MONGO_EXECUTABLE_PATH_WIN,
|
MONGO_EXECUTABLE_PATH_WIN,
|
||||||
|
@ -53,7 +53,7 @@ class MongoDbRunner:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_path_of_mongo_exec():
|
def _get_path_of_mongo_exec():
|
||||||
if get_runtime_os() == WINDOWS:
|
if is_windows_os():
|
||||||
return MONGO_EXECUTABLE_PATH_WIN
|
return MONGO_EXECUTABLE_PATH_WIN
|
||||||
else:
|
else:
|
||||||
return MONGO_EXECUTABLE_PATH_LINUX
|
return MONGO_EXECUTABLE_PATH_LINUX
|
||||||
|
|
Loading…
Reference in New Issue