ensure_packages_installed reconfigure dpkg when mandatory
This commit is contained in:
parent
76bc70ad56
commit
6665aa8fbb
|
@ -76,6 +76,30 @@ async def ensure_packages_installed(
|
|||
if return_code == 0:
|
||||
log.debug(f"Successfully installed packages: {packages_to_install}")
|
||||
return True
|
||||
elif return_code == 100:
|
||||
dpkg_rc, dpkg_stdout, dpkg_stderr = await utils.async_run_command(
|
||||
"sudo dpkg --configure -a",
|
||||
timeout=200,
|
||||
env=non_interactive_env
|
||||
)
|
||||
|
||||
# Install packages
|
||||
return_code, stdout, stderr = await utils.async_run_command(
|
||||
install_cmd,
|
||||
timeout=remaining_timeout,
|
||||
env=non_interactive_env
|
||||
)
|
||||
|
||||
if LOGGING_ENABLED:
|
||||
await ensure_packages_installed_log(f"post-dpkg install stdout: {stdout}")
|
||||
await ensure_packages_installed_log(f"post-dpkg install stderr: {stderr}\ncode: {str(return_code)}")
|
||||
|
||||
if return_code == 0:
|
||||
log.debug(f"Successfully installed packages: {packages_to_install}")
|
||||
return True
|
||||
else:
|
||||
log.error(f"Failed to install packages: {stderr}")
|
||||
return False
|
||||
else:
|
||||
log.error(f"Failed to install packages: {stderr}")
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue