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

Recalculate agent-group hash when executing Agent-group send/recv full #23447

Merged
merged 2 commits into from
May 17, 2024

Conversation

fdalmaup
Copy link
Member

@fdalmaup fdalmaup commented May 15, 2024

Related issue
#23432

Description

Adds the global recalculate-agent-group-hashes command to recalculate the agent-groups hash both in the master and workers when the Agent-group send full is triggered.

Logs example

Description of the manual tests executed in #23432 (comment).

Unit Tests

$ pytest framework/wazuh/core/cluster/tests/ --disable-warnings
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.9.19, pytest-7.3.1, pluggy-0.13.1
rootdir: /home/fdalmau/git/wazuh/framework
plugins: cov-2.12.0, aiohttp-1.0.4, trio-0.7.0, anyio-3.6.2, metadata-2.0.2, tavern-1.23.5, asyncio-0.18.1, html-2.1.1
asyncio: mode=auto
collected 303 items                                                                                                                                                                                       

framework/wazuh/core/cluster/tests/test_client.py ................                                                                                                                                  [  5%]
framework/wazuh/core/cluster/tests/test_cluster.py ...................................                                                                                                              [ 16%]
framework/wazuh/core/cluster/tests/test_common.py ......................................................................................                                                            [ 45%]
framework/wazuh/core/cluster/tests/test_control.py ......                                                                                                                                           [ 47%]
framework/wazuh/core/cluster/tests/test_local_client.py ..............                                                                                                                              [ 51%]
framework/wazuh/core/cluster/tests/test_local_server.py ........................                                                                                                                    [ 59%]
framework/wazuh/core/cluster/tests/test_master.py ...............................................                                                                                                   [ 75%]
framework/wazuh/core/cluster/tests/test_server.py .............................                                                                                                                     [ 84%]
framework/wazuh/core/cluster/tests/test_utils.py ............                                                                                                                                       [ 88%]
framework/wazuh/core/cluster/tests/test_worker.py ..................................                                                                                                                [100%]

==================================================================================== 303 passed, 24 warnings in 1.45s =====================================================================================

@fdalmaup fdalmaup self-assigned this May 15, 2024
@fdalmaup fdalmaup linked an issue May 15, 2024 that may be closed by this pull request
4 tasks
Copy link
Member

@GGP1 GGP1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, but the endpoint PUT /agents/{agent_id}/upgrade_custom failed in the checks.

Although it doesn't seem related to the changes introduced, I think we should double check this (launching the test locally to see if it was sporadic may be it). Since 4.7.4 didn't have failures (nor any sporadic issues in this test) and the 4.7.5 release will contain changes to the agent group hash recalculation only.

@fdalmaup
Copy link
Member Author

The test_agent_PUT_endpoints.tavern.yaml tests were executed locally for the enhancement/23432-group-hash-recalculate branch resulting in the same failure as the one seen in the checks. Also, these were executed for Wazuh v4.7.4 which resulted in the same fail (execution here). An issue will be opened to investigate the cause.

GGP1
GGP1 previously approved these changes May 16, 2024
Copy link
Member

@GGP1 GGP1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fdalmaup fdalmaup force-pushed the enhancement/23432-group-hash-recalculate branch from d8a1af5 to 7c8ebc4 Compare May 16, 2024 12:08
Copy link
Member

@Selutario Selutario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only two requests.

framework/wazuh/core/cluster/master.py Outdated Show resolved Hide resolved
framework/wazuh/core/cluster/worker.py Outdated Show resolved Hide resolved
Base automatically changed from fix/23422-groups-hash to 4.7.5 May 16, 2024 16:13
@TomasTurina TomasTurina dismissed GGP1’s stale review May 16, 2024 16:13

The base branch was changed.

Copy link
Member

@Selutario Selutario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@Selutario
Copy link
Member

The failing framework unit test check is related to Jenkins. The same happened in v4.7.4.

@Selutario Selutario merged commit d99092c into 4.7.5 May 17, 2024
45 of 47 checks passed
@Selutario Selutario deleted the enhancement/23432-group-hash-recalculate branch May 17, 2024 10: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.

Request group hashes recalculation in Agent-groups send full cluster task
3 participants