Skip to content

Commit

Permalink
Merge pull request #5762 from wazuh/bug/5741-error-at-agent-start
Browse files Browse the repository at this point in the history
Changed wazuh-agent service start from install test to registration test
  • Loading branch information
juliamagan authored Oct 8, 2024
2 parents 23d685e + ec22da9 commit a85b6cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ All notable changes to this project will be documented in this file.

### Fixed

- Changed wazuh-agent service start from install test to registration test ([#5762](https://github.com/wazuh/wazuh-qa/pull/5762)) \- (Tests)
- Fix E2E VD tests not working if the Python version is different to 3.9 ([#5787](https://github.com/wazuh/wazuh-qa/pull/5787)) \- (Framework)
- Fix failed to disable wazuh-manager.service ([#5775])(https://github.com/wazuh/wazuh-qa/pull/5775) \- (Tests)
- Fix failed to disable wazuh-manager.service ([#5775](https://github.com/wazuh/wazuh-qa/pull/5775)) \- (Tests)

## [4.9.1] - TBD

Expand Down
16 changes: 5 additions & 11 deletions deployability/modules/testing/tests/helpers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv
])
system_commands = [
"systemctl daemon-reload",
"systemctl enable wazuh-agent",
"systemctl start wazuh-agent",
"systemctl status wazuh-agent"
"systemctl enable wazuh-agent"
]

commands.extend(system_commands)
Expand All @@ -78,7 +76,6 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv
f"WAZUH_AGENT_NAME='{agent_name}' "
f"WAZUH_REGISTRATION_SERVER='MANAGER_IP' "
])
commands.extend(["NET START WazuhSvc"])

elif os_type == 'macos':
if architecture == 'amd64':
Expand All @@ -89,11 +86,6 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv
commands.extend([
f'curl -so wazuh-agent.pkg https://{s3_url}.wazuh.com/{release}/macos/wazuh-agent-{wazuh_version}-1.arm64.pkg && echo "WAZUH_MANAGER=\'MANAGER_IP\' && WAZUH_AGENT_NAME=\'{agent_name}\'" > /tmp/wazuh_envs && sudo installer -pkg ./wazuh-agent.pkg -target /'
])
system_commands = [
'/Library/Ossec/bin/wazuh-control start',
'/Library/Ossec/bin/wazuh-control status'
]
commands.extend(system_commands)

logger.info(f'Installing Agent in {HostInformation.get_os_name_and_version_from_inventory(inventory_path)}')
ConnectionManager.execute_commands(inventory_path, commands)
Expand Down Expand Up @@ -124,7 +116,8 @@ def register_agent(inventory_path, manager_path):
host_ip = HostInformation.get_internal_ip_from_aws_dns(manager_host) if 'amazonaws' in manager_host else manager_host
commands = [
f"sed -i 's/<address>MANAGER_IP<\/address>/<address>{host_ip}<\/address>/g' {WAZUH_CONF}",
"systemctl restart wazuh-agent"
"systemctl start wazuh-agent",
"systemctl status wazuh-agent"
]
ConnectionManager.execute_commands(inventory_path, commands)
except Exception as e:
Expand All @@ -141,7 +134,8 @@ def register_agent(inventory_path, manager_path):
host_ip = HostInformation.get_public_ip_from_aws_dns(manager_host)
commands = [
f"sed -i '.bak' 's/<address>MANAGER_IP<\/address>/<address>{host_ip}<\/address>/g' {WAZUH_MACOS_CONF}",
"/Library/Ossec/bin/wazuh-control restart"
"/Library/Ossec/bin/wazuh-control start",
"/Library/Ossec/bin/wazuh-control status"
]
ConnectionManager.execute_commands(inventory_path, commands)
except Exception as e:
Expand Down

0 comments on commit a85b6cf

Please sign in to comment.