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

Fix bug when changing the Filebeat URL in the Installation Assistant #3110

Merged

Conversation

Enaraque
Copy link
Member

Related issue
#3099

Description

When checking if the Filebeat URL was valid, if it wasn't, it was replaced with a valid URL. However, this change was never included in the wazuh-install.sh because the function was called after the content had already been written to the wazuh-install.sh. Additionally, when evaluating the URL, it was being evaluated using the source_branch variable from the file where it was being evaluated, in this case, from builder.sh, when it should have used the one from the installVariables.sh file.

To solve the first issue, it was simply necessary to change the position of the function since it was executed at the end, after adding the content to the wazuh-install.sh, and therefore it didn't capture any possible changes that might have been made.

The second issue was resolved by evaluating the necessary variables from installVariables.sh. In this case, wazuh_versionand source_branch. To avoid overwriting the source_branch value from builder.sh, it was renamed with a different name. This way, when the Filebeat URL is evaluated, it will use the correct source_branch value.

Tests

  • When the URL needs to be changed
root@ip-172-31-46-84:/home/ubuntu/unattended_installer# bash builder.sh -i -d
Inside checkFilebeatURL
source_branch from builder.sh: 4.9.1
source_branch from installVariables.sh: SOURCE_FROM_INSTALL_VARIABLES
Filebeat URL=https://raw.githubusercontent.com/wazuh/wazuh/SOURCE_FROM_INSTALL_VARIABLES/extensions/elasticsearch/7.x/wazuh-template.json
Changing Filebeat URL...
Outside of checkFilebeatURL
root@ip-172-31-46-84:/home/ubuntu/unattended_installer# cat wazuh-install.sh | grep filebeat_wazuh_template=\"https
filebeat_wazuh_template="https://raw.githubusercontent.com/wazuh/wazuh/master/extensions/elasticsearch/7.x/wazuh-template.json"
  • When the URL does not need to be changed
root@ip-172-31-46-84:/home/ubuntu/unattended_installer# bash builder.sh -i -d
Inside checkFilebeatURL
source_branch from builder.sh: v4.9.0
source_branch from installVariables.sh: v4.9.0
Filebeat URL=https://raw.githubusercontent.com/wazuh/wazuh/v4.9.0/extensions/elasticsearch/7.x/wazuh-template.json
Outside of checkFilebeatURL
root@ip-172-31-46-84:/home/ubuntu/unattended_installer# cat wazuh-install.sh | grep filebeat_wazuh_template=\"https
filebeat_wazuh_template="https://raw.githubusercontent.com/wazuh/wazuh/${source_branch}/extensions/elasticsearch/7.x/wazuh-template.json"

@Enaraque Enaraque requested a review from a team September 10, 2024 10:03
@Enaraque Enaraque self-assigned this Sep 10, 2024
@Enaraque Enaraque linked an issue Sep 10, 2024 that may be closed by this pull request
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.

checkFilebeatURL() does not perform as expected
4 participants