Add sys exit instead of raising AssertionError
This commit is contained in:
parent
23be650eac
commit
69d38acefa
1 changed files with 7 additions and 3 deletions
10
install.py
10
install.py
|
@ -7,6 +7,7 @@ Inspired by https://github.com/dmerejkowsky/dotfiles
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
from urllib.request import urlretrieve
|
from urllib.request import urlretrieve
|
||||||
|
|
||||||
|
@ -38,15 +39,18 @@ class Installer:
|
||||||
|
|
||||||
def verify_secrets(self) -> None:
|
def verify_secrets(self) -> None:
|
||||||
"""The repository contains a secrets.template, that must be taken care of
|
"""The repository contains a secrets.template, that must be taken care of
|
||||||
by the user. If the secrets is wrong, fail.
|
by the user. If the secrets is wrong, or missing, fail.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("secrets", "r") as secrets_file:
|
with open("secrets", "r") as secrets_file:
|
||||||
secrets = secrets_file.read()
|
secrets = secrets_file.read()
|
||||||
# TODO: check the contents too
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise AssertionError("Did you forget to create a 'secrets' file?")
|
print("No 'secrets' file found. Did you forget to create it?")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
# TODO: check the contents of the file
|
||||||
|
|
||||||
def define_os(self) -> str:
|
def define_os(self) -> str:
|
||||||
"""Define what OS we are using."""
|
"""Define what OS we are using."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue