forked from p15670423/monkey
Island: check if version from version file is the same as in island instead of checking if it's lower
This change enables to clean the directory if an older version of monkey island is installed after removing the new one
This commit is contained in:
parent
b0e96822dd
commit
988bdf0471
|
@ -6,7 +6,7 @@ from common.version import get_version
|
||||||
from monkey_island.cc.server_utils.file_utils import create_secure_directory
|
from monkey_island.cc.server_utils.file_utils import create_secure_directory
|
||||||
from monkey_island.cc.setup.version_file_setup import (
|
from monkey_island.cc.setup.version_file_setup import (
|
||||||
get_version_from_dir,
|
get_version_from_dir,
|
||||||
is_version_greater,
|
is_version_different,
|
||||||
write_version,
|
write_version,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def _is_backup_needed(data_dir_path: Path) -> bool:
|
||||||
|
|
||||||
island_version = get_version()
|
island_version = get_version()
|
||||||
|
|
||||||
return is_version_greater(island_version, data_dir_version)
|
return is_version_different(island_version, data_dir_version)
|
||||||
|
|
||||||
|
|
||||||
def _rename_data_dir(data_dir_path: Path):
|
def _rename_data_dir(data_dir_path: Path):
|
||||||
|
|
|
@ -17,5 +17,5 @@ def write_version(dir_path: Path):
|
||||||
version_file_path.write_text(get_version())
|
version_file_path.write_text(get_version())
|
||||||
|
|
||||||
|
|
||||||
def is_version_greater(version1: str, version2: str) -> bool:
|
def is_version_different(version1: str, version2: str) -> bool:
|
||||||
return version.parse(version1) > version.parse(version2)
|
return not version.parse(version1) == version.parse(version2)
|
||||||
|
|
Loading…
Reference in New Issue