aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2021-01-19 18:48:31 +0100
committerAlex <alex@adnab.me>2021-01-19 18:48:31 +0100
commit2e25e150d476934cbe356c34463f5403d100aa76 (patch)
tree1d20c4e680b93db0c0005dbf074793be7a419d26 /app
parenta2eec38de4acb0a58f22dddc161facf44910085a (diff)
parent6e1940061ab6da8021cd9f38818657baa4be2d17 (diff)
downloadinfrastructure-2e25e150d476934cbe356c34463f5403d100aa76.tar.gz
infrastructure-2e25e150d476934cbe356c34463f5403d100aa76.zip
Merge pull request 'secretmgr retourne une erreur bien formatée face à un fichier vide' (#32) from adrien/infrastructure:master into master
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/infrastructure/pulls/32
Diffstat (limited to 'app')
-rwxr-xr-xapp/secretmgr.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/secretmgr.py b/app/secretmgr.py
index 5cf55dc..62eb93a 100755
--- a/app/secretmgr.py
+++ b/app/secretmgr.py
@@ -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)