Skip to content

Commit

Permalink
app.py: validate remotes.json after loading file
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv-tyagi authored and peterbarker committed Jun 24, 2024
1 parent 43a997a commit 4956683
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import re
import requests
import jsonschema
# run at lower priority
os.nice(20)

Expand Down Expand Up @@ -74,8 +75,11 @@ def ref_is_tag(commit_reference):

def load_remotes():
# load file contianing vehicles listed to be built for each remote along with the braches/tags/commits on which the firmware can be built
with open(os.path.join(basedir, 'configs', 'remotes.json'), 'r') as f:
with open(os.path.join(basedir, 'configs', 'remotes.json'), 'r') as f, open(os.path.join(appdir, 'remotes.schema.json'), 'r') as s:
remotes = json.loads(f.read())
schema = json.loads(s.read())
# validate schema
jsonschema.validate(remotes, schema=schema)
set_remotes(remotes)


Expand Down

0 comments on commit 4956683

Please sign in to comment.