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 install package HostManager method #4954

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
7 changes: 4 additions & 3 deletions deps/wazuh_testing/wazuh_testing/tools/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,23 +482,24 @@ def install_package(self, host, url, system='ubuntu'):
host_manager.install_package('my_host', 'http://example.com/package.deb', system='ubuntu')
"""
result = False

if system == 'windows':
result = self.get_host(host).ansible("win_package", f"path={url} arguments=/S", check=False)
elif system == 'ubuntu':
result = self.get_host(host).ansible("apt", f"deb={url}", check=False)
if result['changed'] and result['stderr'] == '':
result = True
elif system == 'centos':
result = self.get_host(host).ansible("yum", f"name={url} state=present"
result = self.get_host(host).ansible("yum", f"name={url} state=present "
'sslverify=false disable_gpg_check=True', check=False)
if 'rc' in result and result['rc'] == 0 and result['changed']:
result = True
elif system == 'macos':
package_name = url.split('/')[-1]
result = self.get_host(host).ansible("command", f"curl -LO {url}", check=False)
cmd = f"installer -pkg {package_name} -target /"
result = self.get_host(host).ansible("command", cmd, check=False)

logging.info(f"Package installed result {result}")

return result

def get_master_ip(self):
Expand Down
Loading