File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,12 @@ def list_active_scenarios():
112
112
@click .command ()
113
113
def down ():
114
114
"""Bring down a running warnet"""
115
- console .print ("[bold yellow]Bringing down the warnet...[/bold yellow]" )
116
-
117
- # Delete warnet-logging namespace
118
- if delete_namespace ("warnet-logging" ):
119
- console .print ("[green]Warnet logging deleted[/green]" )
120
- else :
121
- console .print ("[red]Warnet logging NOT deleted[/red]" )
115
+ with console .status ("[bold yellow]Bringing down the warnet...[/bold yellow]" ):
116
+ # Delete warnet-logging namespace
117
+ if delete_namespace ("warnet-logging" ):
118
+ console .print ("[green]Warnet logging deleted[/green]" )
119
+ else :
120
+ console .print ("[red]Warnet logging NOT deleted[/red]" )
122
121
123
122
# Uninstall tanks
124
123
tanks = get_mission ("tank" )
@@ -134,7 +133,7 @@ def down():
134
133
pods = get_pods ()
135
134
with console .status ("[yellow]Cleaning up remaining pods...[/yellow]" ):
136
135
for pod in pods .items :
137
- cmd = f"kubectl delete pod { pod .metadata .name } "
136
+ cmd = f"kubectl delete pod --ignore-not-found=true { pod .metadata .name } "
138
137
if stream_command (cmd ):
139
138
console .print (f"[green]Deleted pod: { pod .metadata .name } [/green]" )
140
139
else :
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ def run_command(command: str) -> str:
10
10
return result .stdout
11
11
12
12
13
- def stream_command (command : str , env = None ) -> bool :
13
+ def stream_command (command : str ) -> bool :
14
14
process = subprocess .Popen (
15
15
["/bin/bash" , "-c" , command ],
16
16
stdout = subprocess .PIPE ,
@@ -27,6 +27,5 @@ def stream_command(command: str, env=None) -> bool:
27
27
return_code = process .wait ()
28
28
29
29
if return_code != 0 :
30
- print (f"Command failed with return code { return_code } " )
31
- return False
30
+ raise Exception (process .stderr )
32
31
return True
You can’t perform that action at this time.
0 commit comments