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

DTT1 - Provision module - Code improvement #4757

Closed
22 tasks done
fcaffieri opened this issue Dec 7, 2023 · 5 comments · Fixed by #4822
Closed
22 tasks done

DTT1 - Provision module - Code improvement #4757

fcaffieri opened this issue Dec 7, 2023 · 5 comments · Fixed by #4822
Assignees

Comments

@fcaffieri
Copy link
Member

fcaffieri commented Dec 7, 2023

Parent issue: #4749

Description

After finishing the module for the POC, the code of this module requires improvements and the possibility of being imported and called at any time to install anything that the test module may need.
So far it includes installation of rmp and deb packages and installation of Wazuh via AIO and through packages.
Adding installation is required on all systems supported by Wazuh.

Details

  • Fix dependencies on the Worker node
  • Fix dependencies on the Host
  • Improve the provision launcher to be simple and only parses arguments. And accept and append install argument.
  • Create a Utils class with the following functionalities:
    • Method that returns the YAML templates of a path and performs sorting if reported
    • Method that obtains host data from the inventories generated by the allocator and maps the keys
  • Improve the Provision class so that it uses:
    • Model validation with Pydantic, to validate the input
    • Run method which is called by the launcher to execute the flow
    • Package manager that must be in charge of managing the use cases to install what is required
    • Improve the methods to install dependencies on the worker node and the host, reusing what was implemented.
  • Generate yamYAML input for the Workflow engine that includes the complete test flow
  • Fix some validation problems of the schema validator
  • Fix task flow so that it accepts a dictionary within the arguments of the process execution
  • Fix the Jinja2 templates since an error was found when processing them.
  • Improvements to the ansible class:
    • Initialization of required variables
    • Create a method that generates the inventory according to the data provided by the allocator.
    • Method to render the YAMLs required to run the playbook
    • Improvement and adaptation of the method that executes the playbooks
  • Generic fixes:
    • Fix imports into WorkglowEngine and allocator.
@fcaffieri
Copy link
Member Author

Update

Working on the improvement of the code.

@fcaffieri fcaffieri self-assigned this Dec 12, 2023
@fcaffieri
Copy link
Member Author

Update

Working on the improvement of the module:

  • Simplify the launcher.
  • Fix the output according to the one sent by the task flow
  • Code improvements

@fcaffieri
Copy link
Member Author

Update report (WIP)

Finish the improvements.
Improves:

@QU3B1M
Copy link
Member

QU3B1M commented Jan 15, 2024

LGTM!

@fcaffieri
Copy link
Member Author

Improvements and implementations were noted for the next iteration:

  1. Add the uninstaller action by parameter to uninstall the desired component
  2. Allow installing any version of wazuh with Package (Currently only allowed with AIO)
  3. Get ansible_os_family to render templates with jinja2. This makes it easier to reuse templates
  4. Validate dependency tree
    4.1. Validate the working OS in Vagrant
    4.2. Validate the working OS in AWS
    4.3. Adapt the dependencies installed for the tests so that they work on other systems such as CentOS 8
  5. Special VM
  6. Improve or remove the function to load an existing Credential for a VM (currently is not working) Only for Vagrant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
2 participants