Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate the command handler with the module manager #190

Conversation

jr0me
Copy link
Member

@jr0me jr0me commented Sep 30, 2024

Related issue
#146

Description

This pull request integrates the command handler with the module manager, allowing to send commands to the corresponding modules, and introduces updates and refactoring to the command handling and storage mechanisms within the Wazuh agent. The functions executing commands have been modified to use awaitables (so they are effectively coroutines). Some other small refactorings are made.

Tests

  • Compilation without warnings in every supported platform
    • Linux
    • Windows
    • MAC OS X

@jr0me jr0me force-pushed the enhancement/146-integrate-the-command-handler-with-the-module-manager branch from 5bc8d09 to c5bdc88 Compare September 30, 2024 21:00
@jr0me jr0me linked an issue Sep 30, 2024 that may be closed by this pull request
@aritosteles aritosteles self-requested a review September 30, 2024 21:34
@jr0me jr0me changed the title Enhancement/146 integrate the command handler with the module manager Integrate the command handler with the module manager Oct 1, 2024
@jr0me jr0me self-assigned this Oct 1, 2024
@jr0me jr0me marked this pull request as ready for review October 1, 2024 15:37
@nbertoldo nbertoldo force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from 4eaafd1 to ac5c5e9 Compare October 1, 2024 22:39
Base automatically changed from enhancement/17-migrate-syscollector-to-inventory-at-new-agent to master October 1, 2024 23:08
jr0me added 16 commits October 1, 2024 23:55
The class previously named `Command` had a public
data member `m_command`, which used a naming convention
intended for private members. Since all public members
should follow PascalCase, according to the current
clang tidy rules, `m_command` was renamed to `Command`,
causing a name collision with the class itself.

To resolve this and better reflect the class’s role,
which encompasses more than just the command (including
data related to the storage and processing of commands),
the class has been renamed to `CommandEntry`.
Since they are public they should not use
the "m_" prefix.
Public members shouldn't use the "m_" prefix.
There will be some common usage of the classes defined
in this header: Status, CommandEntry. So we begin here
the separation from the commond store specific component.

The idea is that Modules will require to also return
a Status code from the result of a command execution.
… message

This will be used by the CommandEntry and by the modules as the execution
result returned type.
The reason behind this is that it is recommended to
avoid using references on coroutines, hence the pass
by value is intentional.

There's a "conflict of interests" between two clang tidy
checks here, the one being ignored here and another
that warns about using references on coroutines, fixing
the former triggers the latter. But as explained above
the copy is preferred here.
@jr0me jr0me force-pushed the enhancement/146-integrate-the-command-handler-with-the-module-manager branch from 70595a8 to 11f3c67 Compare October 2, 2024 02:56
@TomasTurina TomasTurina merged commit 3afdcca into master Oct 2, 2024
5 checks passed
@TomasTurina TomasTurina deleted the enhancement/146-integrate-the-command-handler-with-the-module-manager branch October 2, 2024 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate the Command Handler with the Module Manager
3 participants