diff --git a/cmdeploy/src/cmdeploy/deployers.py b/cmdeploy/src/cmdeploy/deployers.py index 933a4477..bc8e3b40 100644 --- a/cmdeploy/src/cmdeploy/deployers.py +++ b/cmdeploy/src/cmdeploy/deployers.py @@ -98,6 +98,15 @@ def _install_remote_venv_with_chatmaild(deployer) -> None: dest=remote_dist_file, ) + # Remove venv if its Python is broken, e.g., after OS release upgrade + server.shell( + name="remove stale chatmaild venv if python is broken", + commands=[ + f"{remote_venv_dir}/bin/python -c 'import sys' 2>/dev/null" + f" || rm -rf {remote_venv_dir}", + ], + ) + pip.virtualenv( name=f"chatmaild virtualenv {remote_venv_dir}", path=remote_venv_dir,