From 345be9c2ab127b1d7cc7910ae51e6dd0cbb69bad Mon Sep 17 00:00:00 2001 From: Sarah Gibson Date: Thu, 12 Dec 2024 14:22:50 +0000 Subject: [PATCH] Adds an --rm flag to optionally remove the pod after completion --- deployer/commands/exec/infra_components.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deployer/commands/exec/infra_components.py b/deployer/commands/exec/infra_components.py index a4bba4d40..909f31674 100644 --- a/deployer/commands/exec/infra_components.py +++ b/deployer/commands/exec/infra_components.py @@ -23,6 +23,7 @@ def root_homes( cluster_name: str = typer.Argument(..., help="Name of cluster to operate on"), hub_name: str = typer.Argument(..., help="Name of hub to operate on"), + rm_pod: bool = typer.Option(False, "--rm", help="Automatically delete the pod after completing"), extra_nfs_server: str = typer.Option( None, help="IP address of an extra NFS server to mount" ), @@ -134,6 +135,9 @@ def root_homes( subprocess.check_call(create_cmd) subprocess.check_call(exec_cmd) + # I want to ensure this code runs event if the exec cmd returns an exit code other than 0 + if rm_pod: + delete_pod(pod_name, hub_name) # I want to ensure this code runs event if the exec cmd returns an exit code other than 0 # Delete temporary pod spec file