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 invalid Jinja2 syntax #528

Merged
merged 1 commit into from
Dec 22, 2020
Merged

Fix invalid Jinja2 syntax #528

merged 1 commit into from
Dec 22, 2020

Conversation

Zenidd
Copy link
Contributor

@Zenidd Zenidd commented Dec 21, 2020

This PR was originally opened by @kravietz

Description

localfiles blocks with format = json and labels were not correctly rendered. The following settings led to error:

      - format: 'json'
        location: '/path/to/logs/test.log'
        labels: 
          - key: '@source'
            value: myapp
          - key: '@source2'
            value: myapp2

Related Ansible error:

TASK [../roles/wazuh/ansible-wazuh-manager : Configure the shared-agent.conf] *******************************************************************************************************************
fatal: [test]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'list object' has no attribute 'items'"}

After adding the @kravietz fix, the Configure the shared-agent.conf task ends successfully and the localfile configuration block is rendered as expected:

TASK [../roles/wazuh/ansible-wazuh-manager : Configure the shared-agent.conf] *******************************************************************************************************************
changed: [test]

Correct output localfile block inside agent.conf file

    <localfile>
       <log_format>json</log_format>
       <location>/path/to/logs/test.log</location>
       <label key="@source">myapp</label>
       <label key="@source2">myapp2</label>
    </localfile>

@Zenidd Zenidd self-assigned this Dec 21, 2020
@Zenidd Zenidd mentioned this pull request Dec 21, 2020
@Zenidd Zenidd merged commit c28ee78 into master Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants