diff --git a/monkey/monkey_island/cc/setup/data_dir.py b/monkey/monkey_island/cc/setup/data_dir.py index 0ba011d65..5ea3b49e9 100644 --- a/monkey/monkey_island/cc/setup/data_dir.py +++ b/monkey/monkey_island/cc/setup/data_dir.py @@ -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.setup.version_file_setup import ( get_version_from_dir, - is_version_greater, + is_version_different, write_version, ) @@ -40,7 +40,7 @@ def _is_backup_needed(data_dir_path: Path) -> bool: 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): diff --git a/monkey/monkey_island/cc/setup/version_file_setup.py b/monkey/monkey_island/cc/setup/version_file_setup.py index 52a71ce4f..a1fb2a801 100644 --- a/monkey/monkey_island/cc/setup/version_file_setup.py +++ b/monkey/monkey_island/cc/setup/version_file_setup.py @@ -17,5 +17,5 @@ def write_version(dir_path: Path): version_file_path.write_text(get_version()) -def is_version_greater(version1: str, version2: str) -> bool: - return version.parse(version1) > version.parse(version2) +def is_version_different(version1: str, version2: str) -> bool: + return not version.parse(version1) == version.parse(version2)