-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenew_cert.py
More file actions
31 lines (27 loc) · 788 Bytes
/
renew_cert.py
File metadata and controls
31 lines (27 loc) · 788 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
import subprocess
import os
import sys
VERBOSE = "--verbose" in sys.argv
CERT_FLAG = "cert_invalid.flag"
def run_issue_cert():
cmd = [sys.executable, "issue_cert.py"]
if VERBOSE:
cmd.append("--verbose")
result = subprocess.run(cmd)
return result.returncode == 0
def run_upload_cert():
cmd = [sys.executable, "upload_cert.py"]
if os.path.exists(CERT_FLAG):
cmd.append("--insecure")
if VERBOSE:
cmd.append("--verbose")
result = subprocess.run(cmd)
return result.returncode == 0
if __name__ == "__main__":
if run_issue_cert():
run_upload_cert()
try:
if os.path.exists(CERT_FLAG):
os.remove(CERT_FLAG)
except Exception as e:
print(f"Warning: failed to clean up {CERT_FLAG}: {e}")