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

Hotfix exec when wazuh-template.json do not exist #551

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

cruelsmith
Copy link
Contributor

Pull Request (PR) description

In #516 has been an error introduced that blocks the bootstrap of the filebeat wazuh plugin. This PR add the missing condition to not removing the will when it does not exist.

This PR differ from #543 since it is just a hotfix. The other PR is still the better solution for the feature but changes the current update management of this file.

This Pull Request (PR) fixes the following issues

Closes #542

cruelsmith referenced this pull request Aug 19, 2022
Ensure that we recognize content changes of the local and remote file.
@poloz-lab
Copy link
Contributor

Hi @cruelsmith ,

I tried your hotfix and the exec is applied at every puppet run. I don't have idempotency.

Notice: /Stage[main]/Wazuh::Filebeat_oss/File[/etc/filebeat/wazuh-template.json]/ensure: defined content as '{mtime}2022-09-02 14:42:47 +0000'
In the next Puppet run :
Notice: /Stage[main]/Wazuh::Filebeat_oss/File[/etc/filebeat/wazuh-template.json]/ensure: defined content as '{mtime}2022-09-02 14:47:05 +0000'

It seems that as the onlif is true, the unless is not evaluated.

Do you experience the same behaviour ?

@cruelsmith cruelsmith marked this pull request as draft September 2, 2022 17:26
Fix case where file does not exist so rm will not be called
Fix sh incompatible process substitution <(...) can be used with bash but not with sh that exec uses.
@cruelsmith cruelsmith force-pushed the 4.3_hotfix_cleanup_wazuh_template branch from ecdbe52 to 8b9cb4d Compare September 2, 2022 21:29
Copy link
Contributor Author

@cruelsmith cruelsmith left a comment

Choose a reason for hiding this comment

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

🙈 thanks for the hint @poloz-lab

Note for myself: Trust only tests you did yourself and always ensure you using the right shell when testing the command on the shell.

To make it short the exec from #516 had never worked it always had raised a syntax error and even not it had raised a path missing for command curl. 🤦(to myself)

Now it is really tested. Working in the states if file is missing, file differ from upstream via curl and file is equal with upstream with curl. The exec to remove the file only runs when the file differ and setting the content with the mtime will only be set when file was missing.

@cruelsmith cruelsmith marked this pull request as ready for review September 2, 2022 21:46
Copy link
Member

@vcerenu vcerenu left a comment

Choose a reason for hiding this comment

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

LGTM

c-bordon added a commit that referenced this pull request Sep 21, 2022
Copy link
Member

@c-bordon c-bordon left a comment

Choose a reason for hiding this comment

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

LGTM

Tested

@teddytpc1 teddytpc1 merged commit 52f8636 into wazuh:4.3 Sep 21, 2022
@cruelsmith cruelsmith deleted the 4.3_hotfix_cleanup_wazuh_template branch September 22, 2022 09:10
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.

5 participants