Skip to content

Commit

Permalink
Delete newly created virtualenv if creation fails
Browse files Browse the repository at this point in the history
Fixes #4929: If a virtualenv is created, but a transient network error prevents core dependencies to be installed in this virtualenv (for example, pip3), we should delete the virtualenv to prevent subsequent `./securedrop-admin setup` runs from failing.

(cherry picked from commit a909bd0)
  • Loading branch information
emkll committed Oct 18, 2019
1 parent 51d4bb2 commit b33f082
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions admin/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def envsetup(args):
sdlog.debug(e.output)
sdlog.error(("Unable to create virtualenv. Check network settings"
" and try again."))
sdlog.debug("Cleaning up virtualenv")
if os.path.exists(VENV_DIR):
shutil.rmtree(VENV_DIR)
raise
else:
sdlog.info("Virtualenv already exists, not creating")
Expand Down

0 comments on commit b33f082

Please sign in to comment.