handle missing extra_projects.yaml

This commit is contained in:
Matt Venn
2023-04-28 13:52:48 +02:00
parent 40060b69d2
commit eb41dd0f94
+4
View File
@@ -21,8 +21,12 @@ class Orders():
self.orders = sorted(orders, key=lambda d: d['time'])
def add_extra_project(self, git_url):
try:
with open(self.config['extra_projects']) as fh:
config = yaml.safe_load(fh)
except FileNotFoundError as e:
config = []
config.append({'project': {'url' : git_url, 'timestamp' : time.time()}})
with open(self.config['extra_projects'], 'w') as fh:
yaml.safe_dump(config, fh)