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 Wazuh Agent name conditional in Linux.yml #334

Merged
merged 2 commits into from
Dec 17, 2019

Conversation

jm404
Copy link
Contributor

@jm404 jm404 commented Dec 12, 2019

Hi all,

This PR fixes #333

Best regards,

Jose

@jm404 jm404 self-assigned this Dec 12, 2019
@jm404 jm404 added this to the Sprint - 104 milestone Dec 12, 2019
@manuasir manuasir self-requested a review December 16, 2019 12:07
Copy link
Contributor

@manuasir manuasir left a comment

Choose a reason for hiding this comment

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

Changes are alright but tests failed.

@rshad
Copy link
Contributor

rshad commented Dec 17, 2019

Hi all!

In 7df7418 we changed the conditional statement is defined to

<target variable> is defined and <target variable> != None

Because having is defined only, would make the execution fail when the target variable has null as a value; In this case, Ansible considers the target variable as defined and as it has null value then it fails when searching for a proper valid value. So adding

<target variable> != None

would ensure that it has a valid value assigned.

Tests

Given the variables:

    wazuh_agent_authd:
      enable: true
      port: 1515
      ssl_agent_ca: null
      ssl_auto_negotiate: 'no'

A test demonstration output is:

TASK [wazuh/ansible-wazuh-agent : Check agent registration via authd output] ***
    ok: [agent-bionic] => {
        "msg": {
            "changed": true, 
            "cmd": "/var/ossec/bin/agent-auth  -m manager-bionic -p 1515      ", 
            "delta": "0:00:00.131941", 
            "end": "2019-12-17 11:36:18.952799", 
            "failed": false, 
            "rc": 0, 
            "start": "2019-12-17 11:36:18.820858", 
            "stderr": "2019/12/17 11:36:18 agent-auth: INFO: Started (pid: 5409).\n2019/12/17 11:36:18 agent-auth: INFO: No authentication password provided.\n2019/12/17 11:36:18 agent-auth: INFO: Connected to 172.18.0.2:1515\n2019/12/17 11:36:18 agent-auth: INFO: Using agent name as: agent-bionic\n2019/12/17 11:36:18 agent-auth: INFO: Send request to manager. Waiting for reply.\n2019/12/17 11:36:18 agent-auth: INFO: Received response with agent key\n2019/12/17 11:36:18 agent-auth: INFO: Valid key created. Finished.\n2019/12/17 11:36:18 agent-auth: INFO: Connection closed.",
            "stderr_lines": [
                "2019/12/17 11:36:18 agent-auth: INFO: Started (pid: 5409).", 
                "2019/12/17 11:36:18 agent-auth: INFO: No authentication password provided.", 
                "2019/12/17 11:36:18 agent-auth: INFO: Connected to 172.18.0.2:1515", 
                "2019/12/17 11:36:18 agent-auth: INFO: Using agent name as: agent-bionic", 
                "2019/12/17 11:36:18 agent-auth: INFO: Send request to manager. Waiting for reply.", 
                "2019/12/17 11:36:18 agent-auth: INFO: Received response with agent key", 
                "2019/12/17 11:36:18 agent-auth: INFO: Valid key created. Finished.", 
                "2019/12/17 11:36:18 agent-auth: INFO: Connection closed."
            ], 
            "stdout": "", 
            "stdout_lines": []
        }
    }

Kr,

Rshad

@manuasir manuasir merged commit a287d6e into devel Dec 17, 2019
@manuasir manuasir deleted the feature-333-fix-agent-name branch December 17, 2019 12:01
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