coturn retourne une erreur bien formatée face à un fichier vide (il pourrait renvoyer autre chose), plus bug nom de variable
This commit is contained in:
parent
98280c8628
commit
6e1940061a
1 changed files with 4 additions and 1 deletions
|
@ -103,6 +103,9 @@ class bcolors:
|
||||||
|
|
||||||
def read_secret(key, file_path):
|
def read_secret(key, file_path):
|
||||||
lines = [l.strip() for l in open(file_path, "r")]
|
lines = [l.strip() for l in open(file_path, "r")]
|
||||||
|
if len(lines) == 0:
|
||||||
|
print(bcolors.FAIL, "ERROR:", bcolors.ENDC, "Empty file in", file_path)
|
||||||
|
sys.exit(-1)
|
||||||
l0 = lines[0].split(" ")
|
l0 = lines[0].split(" ")
|
||||||
stype = l0[0]
|
stype = l0[0]
|
||||||
secret = {"type": stype, "key": key}
|
secret = {"type": stype, "key": key}
|
||||||
|
@ -275,7 +278,7 @@ def gen_secrets_base(secrets, regen):
|
||||||
line = input().strip()
|
line = input().strip()
|
||||||
if line == ".":
|
if line == ".":
|
||||||
break
|
break
|
||||||
vals.append(line)
|
lines.append(line)
|
||||||
val = "\n".join(lines)
|
val = "\n".join(lines)
|
||||||
consul_server.kv.put(key, val)
|
consul_server.kv.put(key, val)
|
||||||
print(bcolors.OKCYAN, "Value set.", bcolors.ENDC)
|
print(bcolors.OKCYAN, "Value set.", bcolors.ENDC)
|
||||||
|
|
Reference in a new issue