Skip to content
Snippets Groups Projects
Commit f13674bd authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Edit cloudify_tco2reg.py

parent ab7946a6
No related branches found
No related tags found
No related merge requests found
Pipeline #100279 failed
...@@ -40,18 +40,6 @@ cwd = os.getcwd() ...@@ -40,18 +40,6 @@ cwd = os.getcwd()
#ssl_keyfile=f"{cwd}/key.pem" #ssl_keyfile=f"{cwd}/key.pem"
#ssl_certfile=f"{cwd}/cert.pem" #ssl_certfile=f"{cwd}/cert.pem"
if not os.path.isfile(ssl_keyfile) or not os.path.isfile(ssl_certfile):
cn = os.uname().nodename # Equivalent to `!echo $HOSTNAME`
openssl_cmd = [
"openssl", "req", "-x509", "-newkey", "rsa:4096",
"-keyout", "key.pem", "-out", "cert.pem",
"-sha256", "-days", "3650", "-nodes",
"-subj", f"/C=XX/ST=Hamburg/L=Hamburg/O=Test/OU=Test/CN={cn}"
]
subprocess.run(openssl_cmd, check=True)
def is_port_free(port, host="localhost"): def is_port_free(port, host="localhost"):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex((host, port)) != 0 # Returns True if the port is free return s.connect_ex((host, port)) != 0 # Returns True if the port is free
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment