-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_pod.py
More file actions
36 lines (25 loc) · 830 Bytes
/
Copy pathdelete_pod.py
File metadata and controls
36 lines (25 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import os
parser = argparse.ArgumentParser(description="Delete test pods.")
parser.add_argument(
"-n",
"--name",
dest="pod_name",
)
parser.add_argument("-a", "--all", action="store_true")
args = parser.parse_args()
os.system("solid stop")
if args.all:
os.system("sudo rm -rf /opt/solid/server/")
else:
os.system(f"sudo rm -rf /opt/solid/server/{args.pod_name}")
# WARNING Be very careful with this. This searches for a pod_name in various files.
# But if I am removing pod named `abc` and there is another pod `abcdef` then both
# would seem to get wiped out.
#
# ALSO the use of * is very problematic!!!!!!!
os.system(
f"grep -nrl '{args.pod_name}*' /opt/solid/server/.internal/ | sudo"
" xargs rm -r"
)
os.system("solid start")