#2912 - Updates to remaining action refactoring

This commit is contained in:
Charlie Crane
2024-10-18 12:07:53 +01:00
parent a90aec2bcd
commit 1b1f3e4f71
8 changed files with 45 additions and 32 deletions

View File

@@ -23,13 +23,11 @@ class NodeFolderAbstractAction(AbstractAction):
verb: ClassVar[str]
@classmethod
def form_request(cls, node_id: int, folder_id: int) -> RequestFormat:
def form_request(cls, config: ConfigSchema) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
node_name = cls.manager.get_node_name_by_idx(node_id)
folder_name = cls.manager.get_folder_name_by_idx(node_idx=node_id, folder_idx=folder_id)
if node_name is None or folder_name is None:
if config.node_name is None or config.folder_name is None:
return ["do_nothing"]
return ["network", "node", node_name, "file_system", "folder", folder_name, cls.verb]
return ["network", "node", config.node_name, "file_system", "folder", config.folder_name, cls.verb]
class NodeFolderScanAction(NodeFolderAbstractAction, identifier="node_folder_scan"):