#1859 - Added the call to file system reset
This commit is contained in:
@@ -17,22 +17,20 @@ from primaite.simulator.system.services.service import Service
|
||||
class WebServer(Service):
|
||||
"""Class used to represent a Web Server Service in simulation."""
|
||||
|
||||
_last_response_status_code: Optional[HttpStatusCode] = None
|
||||
last_response_status_code: Optional[HttpStatusCode] = None
|
||||
|
||||
def set_original_state(self):
|
||||
"""Sets the original state."""
|
||||
print(f"Setting WebServer original state on node {self.software_manager.node.hostname}")
|
||||
super().set_original_state()
|
||||
vals_to_include = {"last_response_status_code"}
|
||||
self._original_state.update(self.model_dump(include=vals_to_include))
|
||||
|
||||
def reset_component_for_episode(self, episode: int):
|
||||
"""Reset the original state of the SimComponent."""
|
||||
self._last_response_status_code = None
|
||||
print(f"Resetting WebServer state on node {self.software_manager.node.hostname}")
|
||||
super().reset_component_for_episode(episode)
|
||||
|
||||
@property
|
||||
def last_response_status_code(self) -> HttpStatusCode:
|
||||
"""The latest http response code."""
|
||||
return self._last_response_status_code
|
||||
|
||||
@last_response_status_code.setter
|
||||
def last_response_status_code(self, val: Any):
|
||||
self._last_response_status_code = val
|
||||
|
||||
def describe_state(self) -> Dict:
|
||||
"""
|
||||
Produce a dictionary describing the current state of this object.
|
||||
|
||||
Reference in New Issue
Block a user