Open TomasTurina opened 3 weeks ago
Started looking into the issue and its requirements. Also looking at the current state of the involved components' code and the branch enhancement/17-migrate-syscollector-to-inventory-at-new-agent.
Created branch and linked it to this issue. Started looking into the CommandHandler
, CommandStore
and ModuleWrapper
to come up with a solution.
Implemented first attempt to process a command, fetching its corresponding module and passing to it the command b4dc05b0c357c08ca16f8449efa0a554f401c325
Now it's necessary to come up with a non blocking mechanism to execute commands.
Implemented first approach with coroutines. The functions (in modules, module wrapper, etc) that execute the commands needed to return awaitables
among other changes. Testing with the new server comms mvp.
Defined an initial format for the stateful messages created by command executions.
{
"data":
{
"id": str,
"error": int,
"message": str
},
"module": str
}
Further improvements to the coroutines approach used so far. There's a dependency between the ModularManager, ModuleWrapper, Inventory, Command, CommandStore, CommandHandler that needs further iterations to improve. For instance the error and result codes or messages that come from a command being stored until it is executed and then communicated to the server needs to be settled.
Created draft PR. Timeout implementation is currently missing, as well as the insurance of execution order, since at the moment only one sequential execution at the time is allowed. Despite this, and despite a review is still missing, the issue will be blocked until https://github.com/wazuh/wazuh-agent/pull/45 is merged.
First PR merged, now looking into adding a timeout mechanism to dispatched commands, and to allow multiple commands to be dispatched simultaneously.
Debugging the timeout mechanism implemented. Working on branch https://github.com/wazuh/wazuh-agent/tree/enhancement/146-simultaneous-command-dispatch-with-timeout
Parent issue:
Description
After the development of the new Command Handler, it is necessary to integrate it with the Module Manager so that modules can execute commands and report their feedback.
Considerations
After the implementation is complete, we also need to add some UT to test the entire execution flow of a command.