Skip to content

Commit 131ff30

Browse files
authored
Merge pull request #790 from bitcoin-dev-project/helm-down-first
warnet down: ensure helm releases are uninstalled first
2 parents c6d520b + 63e4a53 commit 131ff30

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/warnet/control.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ def down():
151151
"""Bring down a running warnet quickly"""
152152

153153
def uninstall_release(namespace, release_name):
154-
cmd = f"helm uninstall {release_name} --namespace {namespace} --wait=false"
155-
subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
156-
return f"Initiated uninstall for: {release_name} in namespace {namespace}"
154+
cmd = f"helm uninstall {release_name} --namespace {namespace} --wait"
155+
print(f"Initiating uninstall of {release_name} in namespace {namespace}")
156+
subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
157+
return f"Uninstalled {release_name} in namespace {namespace}"
157158

158159
def delete_pod(pod_name, namespace):
159160
cmd = f"kubectl delete pod --ignore-not-found=true {pod_name} -n {namespace} --grace-period=0 --force"
@@ -215,6 +216,13 @@ def delete_pod(pod_name, namespace):
215216
executor.submit(uninstall_release, release["namespace"], release["name"])
216217
)
217218

219+
# Wait for all tasks to complete and print results
220+
for future in as_completed(futures):
221+
console.print(f"[yellow]{future.result()}[/yellow]")
222+
223+
with ThreadPoolExecutor(max_workers=10) as executor:
224+
futures = []
225+
218226
# Delete remaining pods
219227
pods = get_pods()
220228
for pod in pods:

0 commit comments

Comments
 (0)