Add simple check for empty values in secrets

This commit is contained in:
flyingscorpio@pinebookpro 2020-09-09 16:29:01 +02:00
parent 020a3b10c6
commit 0e1872aea5

View file

@ -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."""