Skip to content

Commit

Permalink
Working venv reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Sep 17, 2020
1 parent 9b5ff3a commit 5d54475
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions utils/venv-manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def run_logged_subprocess(command: Union[str, list], timeout: int = 10, shell: b


def create_environment() -> int:
"""Creates a virtual environment for webqueue2]
"""Creates a virtual environment for webqueue2
Exit Codes:
0 = Success
Expand Down Expand Up @@ -184,7 +184,7 @@ def create_environment() -> int:


def delete_environment() -> int:
"""Deletes a virtual environment for webqueue2]
"""Deletes a virtual environment for webqueue2
Exit Codes:
0 = Success
Expand All @@ -201,6 +201,29 @@ def delete_environment() -> int:
logger.critical(f"Failed to delete virtual environment {VENV_DIR} at {VENV_DIR}. Exiting")
return 5

def reset_environment() -> int:
"""Resets a virtual environment for webqueue2
Exit Codes:
0 = Success
5 = Could not delete VENV_DIR
10 = Could not create VENV_DIR
Returns:
int: Exit code
"""
delete_returncode = delete_environment()
if delete_returncode != 0:
logger.critical(f"Failed to reset virtual environment {VENV_DIR} at {VENV_DIR}. Exiting")
return 5

create_returncode = create_environment()
if create_returncode != 0:
logger.critical(f"Failed to reset virtual environment {VENV_DIR} at {VENV_DIR}. Exiting")
return 10

logger.info(f"Successfully reset virtual environment {VENV_DIR} at {VENV_DIR}. Exiting")


if __name__ == "__main__":
args = get_args()
Expand Down

0 comments on commit 5d54475

Please sign in to comment.