Verify that the secrets file exists

This commit is contained in:
flyingscorpio@arch-desktop 2020-09-08 12:09:29 +02:00
parent b12f11478d
commit 942f0f2a63

View file

@ -25,6 +25,7 @@ class Installer:
update: bool = False,
hide_commands: bool = False,
):
self.verify_secrets()
yaml = YAML(typ="safe")
self.conf = yaml.load(Path("configs.yml").text())
self.base_dir = Path.getcwd()
@ -35,6 +36,18 @@ class Installer:
self.hide_commands = hide_commands
self.operating_system = self.define_os()
def verify_secrets(self) -> None:
"""The repository contains a secrets.template, that must be taken care of
by the user. If the secrets is wrong, fail.
"""
try:
with open("secrets", "r") as secrets_file:
secrets = secrets_file.read()
# TODO: check the contents too
except FileNotFoundError:
raise AssertionError("Did you forget to create a 'secrets' file?")
def define_os(self) -> str:
"""Define what OS we are using."""