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

Changed wazuh-agent service start from install test to registration test #5762

Merged
merged 7 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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