2299: Remove calls to corrupt.
This commit is contained in:
@@ -162,9 +162,6 @@ class File(FileSystemItemABC):
|
|||||||
if self.previous_hash is None:
|
if self.previous_hash is None:
|
||||||
self.previous_hash = current_hash
|
self.previous_hash = current_hash
|
||||||
|
|
||||||
# if the previous hash and current hash do not match, mark file as corrupted
|
|
||||||
if self.previous_hash is not current_hash:
|
|
||||||
self.corrupt()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def repair(self) -> bool:
|
def repair(self) -> bool:
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class FileSystemItemABC(SimComponent):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def check_hash(self) -> bool:
|
def check_hash(self) -> bool:
|
||||||
"""
|
"""
|
||||||
Checks the has of the file to detect any changes.
|
Checks the hash of the file to detect any changes.
|
||||||
|
|
||||||
For current implementation, any change in file hash means it is compromised.
|
For current implementation, any change in file hash means it is compromised.
|
||||||
|
|
||||||
|
|||||||
@@ -381,17 +381,17 @@ class Folder(FileSystemItemABC):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# iterate through the files and run a check hash
|
# iterate through the files and run a check hash
|
||||||
no_corrupted_files = True
|
# no_corrupted_files = True
|
||||||
|
|
||||||
for file_id in self.files:
|
for file_id in self.files:
|
||||||
file = self.get_file_by_id(file_uuid=file_id)
|
file = self.get_file_by_id(file_uuid=file_id)
|
||||||
file.check_hash()
|
file.check_hash()
|
||||||
if file.health_status == FileSystemItemHealthStatus.CORRUPT:
|
# if file.health_status == FileSystemItemHealthStatus.CORRUPT:
|
||||||
no_corrupted_files = False
|
# no_corrupted_files = False
|
||||||
|
|
||||||
# if one file in the folder is corrupted, set the folder status to corrupted
|
# if one file in the folder is corrupted, set the folder status to corrupted
|
||||||
if not no_corrupted_files:
|
# if not no_corrupted_files:
|
||||||
self.corrupt()
|
# self.corrupt()
|
||||||
|
|
||||||
self.sys_log.info(f"Checking hash of folder {self.name} (id: {self.uuid})")
|
self.sys_log.info(f"Checking hash of folder {self.name} (id: {self.uuid})")
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user