Added rollBack to several exit points #2882
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The aim of this PR is to call the rollback function to several exit points in the Wazuh installation assistant. These rollbacks prevent having Wazuh installed wrongly or incompletely in the system.
Some rollback functions have been called in the Password tool. To avoid performing an undesired rollback, a check has been added to perform the rollback only when the Installation Assistant is being used. In other words, when the rollback function is available.
The research of all the exit points is in: #2785 (comment)
Tests
🟢 Normal rollback in Assistant
The Wazuh manager is installed. The Filebeat installation fails and the Wazuh manager is uninstalled in the removal.
🟢 Password function rollback using Assistant
Notice that the backup can not be created:
ERROR: The backup could not be created
, and every component installed is removed using the rollback function.🟢 Password function rollback using password tool
The Wazuh indexer is installed and the cluster is initialized.
After changing the passwords and failing, the Wazuh indexer that is installed is not uninstalled, as the Wazuh password tool does not have the rollback function.