Database patch

This commit is contained in:
Marek Wolan
2024-01-11 15:40:37 +00:00
parent ed5591caf8
commit 842e59f596
2 changed files with 8 additions and 2 deletions

View File

@@ -247,3 +247,8 @@ class DatabaseService(Service):
if timestep == 1:
self.backup_database()
return super().apply_timestep(timestep)
def _update_patch_status(self) -> None:
super()._update_patch_status()
if self._patching_countdown is None:
self.restore_backup()

View File

@@ -193,8 +193,9 @@ class Software(SimComponent):
def patch(self) -> None:
"""Perform a patch on the software."""
self._patching_countdown = self.patching_duration
self.set_health_state(SoftwareHealthState.PATCHING)
if self.health_state_actual in (SoftwareHealthState.COMPROMISED, SoftwareHealthState.GOOD):
self._patching_countdown = self.patching_duration
self.set_health_state(SoftwareHealthState.PATCHING)
def _update_patch_status(self) -> None:
"""Update the patch status of the software."""