diff --git a/src/primaite/simulator/core.py b/src/primaite/simulator/core.py index fb6db3ac..9ead877e 100644 --- a/src/primaite/simulator/core.py +++ b/src/primaite/simulator/core.py @@ -196,10 +196,6 @@ class SimComponent(BaseModel): } return state - def scan(self) -> None: - """Update the visible statuses of the SimComponent.""" - pass - def apply_request(self, request: List[str], context: Dict = {}) -> None: """ Apply a request to a simulation component. Request data is passed in as a 'namespaced' list of strings. diff --git a/src/primaite/simulator/file_system/file_system.py b/src/primaite/simulator/file_system/file_system.py index 72ca1b51..59a00c6f 100644 --- a/src/primaite/simulator/file_system/file_system.py +++ b/src/primaite/simulator/file_system/file_system.py @@ -119,12 +119,6 @@ class FileSystemItemABC(SimComponent): """ return convert_size(self.size) - def scan(self) -> None: - """Update the FileSystemItem states.""" - super().scan() - - self.visible_health_status = self.health_status - @abstractmethod def check_hash(self) -> bool: """ @@ -514,6 +508,8 @@ class Folder(FileSystemItemABC): # scan one file per timestep file = self.get_file_by_id(file_uuid=list(self.files)[self.scan_duration - 1]) file.scan() + if file.visible_health_status == FileSystemItemHealthStatus.CORRUPTED: + self.visible_health_status = FileSystemItemHealthStatus.CORRUPTED self.scan_duration -= 1 def get_file(self, file_name: str) -> Optional[File]: @@ -613,8 +609,6 @@ class Folder(FileSystemItemABC): def scan(self) -> None: """Update Folder visible status.""" - super().scan() - if self.scan_duration <= -1: # scan one file per timestep self.scan_duration = len(self.files) @@ -799,10 +793,9 @@ class File(FileSystemItemABC): def scan(self) -> None: """Updates the visible statuses of the file.""" - super().scan() - path = self.folder.name + "/" + self.name self.folder.fs.sys_log.info(f"Scanning file {self.sim_path if self.sim_path else path}") + self.visible_health_status = self.health_status def check_hash(self) -> bool: """ diff --git a/src/primaite/simulator/system/services/service.py b/src/primaite/simulator/system/services/service.py index aa2fef5e..24de027c 100644 --- a/src/primaite/simulator/system/services/service.py +++ b/src/primaite/simulator/system/services/service.py @@ -84,9 +84,6 @@ class Service(IOSoftware): def scan(self) -> None: """Update the service visible states.""" - # update parent states - super().scan() - # update the visible operating state self.health_state_visible = self.health_state_actual diff --git a/src/primaite/simulator/system/software.py b/src/primaite/simulator/system/software.py index 0d25a89f..cfc0e56f 100644 --- a/src/primaite/simulator/system/software.py +++ b/src/primaite/simulator/system/software.py @@ -175,8 +175,6 @@ class Software(SimComponent): def scan(self) -> None: """Update the observed health status to match the actual health status.""" - super().scan() - self.health_state_visible = self.health_state_actual