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

Include retry install package logic in case of lock file is currently in use #5421

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ All notable changes to this project will be documented in this file.

### Fixed

- Include logic to retry package installation if the lock file is currently in use ([#5421](https://github.com/wazuh/wazuh-qa/pull/5421)) \- (Framework)
- Fix multigroups guess system test ([#5396](https://github.com/wazuh/wazuh-qa/pull/5396)) \- (Tests)
- Fix hotfixes syscollector agent simulator messages ([#5379](https://github.com/wazuh/wazuh-qa/pull/5379)) \- (Framework)
- Fix restart agent in change manager Vulnerability Detector E2E test case ([#5355](https://github.com/wazuh/wazuh-qa/pull/5355)) \- (Tests)
Expand Down
10 changes: 7 additions & 3 deletions deps/wazuh_testing/wazuh_testing/tools/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ def install_pkg_package(host, url):

retry_installation_errors = [
'This installation package could not be opened',
'Could not get lock',
'error: dpkg frontend lock was locked by another process with pid',
'yum lockfile is held by another process'
]

result = {}
Expand Down Expand Up @@ -559,12 +562,13 @@ def install_pkg_package(host, url):
or not (result.get('changed', False) or result.get('rc') == 0 or result.get('stderr', None) == '')

if failed_installation:
if not any(re.search(error, result.get('msg', '')) for error in retry_installation_errors):
if not any(re.search(error, result.get('msg', '')) for error in retry_installation_errors) and \
not any(re.search(error, result.get('stderr', '')) for error in retry_installation_errors):
logging.error("Installation failed. Installation will not be retried.")
raise RuntimeError(f"Failed to install package in {host}: {result}")

logging.error(f"Error installing {url} in {host}:"
'Corrupted package detected. Retrying installation...')
logging.error(f"Error installing {url} in {host}: Retrying installation...")

sleep(retry_delay)
else:
break
Expand Down
Loading