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

Migrate Syscollector to Inventory at new-agent repository #45

Merged

Conversation

nbertoldo
Copy link
Member

@nbertoldo nbertoldo commented Jul 18, 2024

This PR migrates Syscollector module from the wazuh/wazuh repository to the wazuh/wazuh-agent repository as described in #17.

Description

This PR migrates the Syscollector module from the wazuh/wazuh repository to the wazuh/wazuh-agent repository, following the tasks outlined in #15. This migration is part of the ongoing effort to modularize components in the agent repository. It involves refactoring code, adapting to the new repository structure, and ensuring that the migrated modules (Syscollector and DBsync) function correctly in the new environment.

Changes

Code Migration:

  • Migrated the Syscollector and DBsync code from the wazuh/wazuh repository to the wazuh/wazuh-agent repository.
  • Refactored classes, functions, and variable names to fit the new modular architecture (renamed "Syscollector" to "Inventory").
  • Updated the CMake files and added new dependencies supported by vcpkg.

Integration with Queue:

  • Integrated Syscollector (now Inventory) with the new Queue component, ensuring the proper handling of messages.

Dependencies:

  • Migrated dependencies such as libdb, pacman, procps, and rpm to vcpkg where possible.
  • Removed unsupported or redundant libraries, including rsync.

Testing & Validation:

  • Added new tests for the migrated modules (Inventory, DBsync, and the new module manager).
  • Ensured compatibility with Windows by adapting the code for MSVC compilation.
  • Refactored logging mechanisms to align with the new Logger implementation.

Code Cleanup:

  • Removed legacy code for unsupported operating systems.
  • Refined the code by analyzing if the http-request used by data-provider could be removed.

Proposal

  • Complete migration and ensure all related modules (Inventory, DBsync) work correctly after refactoring and integration.
  • Address any missing dependencies by researching how to integrate unsupported packages into vcpkg or finding alternatives.
  • Finalize tests and run validation to ensure no regressions occur in functionality.

Tests

  • Compilation succeeded across all supported platforms (including Windows with MSVC).
  • Validated package installation and upgrades.
  • Unit and integration tests for Syscollector (Inventory) and DBsync passed successfully.

Tasks

  • Identify the code in the wazuh/wazuh repository.
  • Migrate the code to the wazuh/wazuh-agent repository.
  • Refactor the code as necessary to fit the new repository structure.
  • Test the migrated code to ensure it works correctly in the new repository.

@nbertoldo nbertoldo linked an issue Jul 18, 2024 that may be closed by this pull request
29 tasks
@nbertoldo nbertoldo requested a review from cborla July 18, 2024 13:42
@nbertoldo nbertoldo force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch 3 times, most recently from 08130df to 5b84f7e Compare August 15, 2024 19:47
@ncvicchi ncvicchi force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch 2 times, most recently from c213c35 to cfa7740 Compare August 27, 2024 14:49
@nbertoldo nbertoldo force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from 92bda1d to 75a7ee9 Compare August 30, 2024 14:44
@nbertoldo nbertoldo marked this pull request as ready for review September 2, 2024 22:02
@nbertoldo nbertoldo force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from ac71ab9 to 34ff756 Compare September 3, 2024 13:33
Copy link
Member

@TomasTurina TomasTurina left a comment

Choose a reason for hiding this comment

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

Are the UT of the new modules/components running in the GHA workflows (Linux, Windows and macOS)?

.gitignore Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
src/agent/src/agent.cpp Show resolved Hide resolved
src/agent/src/agent.cpp Outdated Show resolved Hide resolved
src/modules/inventory/src/inventory.cpp Outdated Show resolved Hide resolved
src/modules/inventory/tests/invNormalizer/CMakeLists.txt Outdated Show resolved Hide resolved
src/modules/inventory/tests/inventoryImp/CMakeLists.txt Outdated Show resolved Hide resolved
src/modules/tests/CMakeLists.txt Outdated Show resolved Hide resolved
src/modules/tests/moduleManager_test.cpp Outdated Show resolved Hide resolved
@ncvicchi ncvicchi force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch 3 times, most recently from 9a3508f to 8700139 Compare September 5, 2024 17:10
src/Makefile Outdated Show resolved Hide resolved
src/Makefile Outdated Show resolved Hide resolved
@cborla cborla closed this Sep 12, 2024
@cborla cborla deleted the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch September 12, 2024 02:14
@cborla cborla restored the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch September 12, 2024 02:14
@cborla cborla reopened this Sep 12, 2024
@ncvicchi ncvicchi force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from 21640a3 to da7a0eb Compare September 19, 2024 02:55
@LucioDonda LucioDonda force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from b8fe691 to e8c737f Compare September 20, 2024 20:52
@nbertoldo nbertoldo force-pushed the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch from 4537aa5 to be84840 Compare September 23, 2024 21:15
@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
Copy link
Member

@cborla cborla left a comment

Choose a reason for hiding this comment

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

LGTM!

@cborla cborla merged commit daf6f53 into master Oct 1, 2024
5 checks passed
@cborla cborla deleted the enhancement/17-migrate-syscollector-to-inventory-at-new-agent branch October 1, 2024 23:08
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.

Migrate Syscollector module to new agent
7 participants