From 0e1872aea5278334a00313940ef8c70ef124e3d5 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@pinebookpro" Date: Wed, 9 Sep 2020 16:29:01 +0200 Subject: [PATCH] Add simple check for empty values in secrets --- install.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install.py b/install.py index 013efcf..cca983f 100755 --- a/install.py +++ b/install.py @@ -46,15 +46,19 @@ class Installer: with open("secrets", "r") as secrets_file: secrets = [ line.strip() - for line in secrets_file.read() + for line in secrets_file.readlines() if not line.startswith("#") and line.strip() ] except FileNotFoundError: print("No 'secrets' file found. Did you forget to create it?") sys.exit(1) - else: - pass - # TODO: check the contents of the file + for line in secrets: + key, value = line.split("=") + value = value.replace("'", "").replace('"', "") + if not value: + print(line) + print(f" 'secrets' file has no value for {key}, please add one.") + sys.exit(1) def define_os(self) -> str: """Define what OS we are using."""