Database patch
This commit is contained in:
@@ -247,3 +247,8 @@ class DatabaseService(Service):
|
|||||||
if timestep == 1:
|
if timestep == 1:
|
||||||
self.backup_database()
|
self.backup_database()
|
||||||
return super().apply_timestep(timestep)
|
return super().apply_timestep(timestep)
|
||||||
|
|
||||||
|
def _update_patch_status(self) -> None:
|
||||||
|
super()._update_patch_status()
|
||||||
|
if self._patching_countdown is None:
|
||||||
|
self.restore_backup()
|
||||||
|
|||||||
@@ -193,8 +193,9 @@ class Software(SimComponent):
|
|||||||
|
|
||||||
def patch(self) -> None:
|
def patch(self) -> None:
|
||||||
"""Perform a patch on the software."""
|
"""Perform a patch on the software."""
|
||||||
self._patching_countdown = self.patching_duration
|
if self.health_state_actual in (SoftwareHealthState.COMPROMISED, SoftwareHealthState.GOOD):
|
||||||
self.set_health_state(SoftwareHealthState.PATCHING)
|
self._patching_countdown = self.patching_duration
|
||||||
|
self.set_health_state(SoftwareHealthState.PATCHING)
|
||||||
|
|
||||||
def _update_patch_status(self) -> None:
|
def _update_patch_status(self) -> None:
|
||||||
"""Update the patch status of the software."""
|
"""Update the patch status of the software."""
|
||||||
|
|||||||
Reference in New Issue
Block a user