Add simple check for empty values in secrets
This commit is contained in:
parent
020a3b10c6
commit
0e1872aea5
1 changed files with 8 additions and 4 deletions
12
install.py
12
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."""
|
||||
|
|
Loading…
Add table
Reference in a new issue