Skip to content

Commit d6f4ed3

Browse files
committed
control: update down with can_delete_pods
We want to back out early if the user is not able to bring down the network
1 parent 2cf8292 commit d6f4ed3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/warnet/control.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
TANK_MISSION,
2727
)
2828
from .k8s import (
29+
can_delete_pods,
2930
delete_pod,
3031
get_default_namespace,
3132
get_default_namespace_or,
@@ -138,6 +139,10 @@ def delete_pod(pod_name, namespace):
138139
subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
139140
return f"Initiated deletion of pod: {pod_name} in namespace {namespace}"
140141

142+
if not can_delete_pods():
143+
click.secho("You do not have permission to bring down the network.", fg="red")
144+
return
145+
141146
namespaces = get_namespaces()
142147
release_list: list[dict[str, str]] = []
143148
for v1namespace in namespaces:

0 commit comments

Comments
 (0)