forked from Deuxfleurs/infrastructure
Merge pull request 'secretmgr retourne une erreur bien formatée face à un fichier vide' (#32) from adrien/infrastructure:master into master
Reviewed-on: Deuxfleurs/infrastructure#32
This commit is contained in:
commit
2e25e150d4
1 changed files with 4 additions and 1 deletions
|
@ -107,6 +107,9 @@ class bcolors:
|
|||
|
||||
def read_secret(key, file_path):
|
||||
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(" ")
|
||||
stype = l0[0]
|
||||
secret = {"type": stype, "key": key}
|
||||
|
@ -280,7 +283,7 @@ def gen_secrets_base(secrets, regen):
|
|||
line = input().strip()
|
||||
if line == ".":
|
||||
break
|
||||
vals.append(line)
|
||||
lines.append(line)
|
||||
val = "\n".join(lines)
|
||||
consul_server.kv.put(key, val)
|
||||
print(bcolors.OKCYAN, "Value set.", bcolors.ENDC)
|
||||
|
|
Loading…
Reference in a new issue