if webhook fails 500 is returned

This commit is contained in:
Andrea Mannocci 2020-07-08 10:21:41 +02:00
parent 7b3a883747
commit 04636edf68
1 changed files with 7 additions and 4 deletions

11
main.py
View File

@ -43,7 +43,10 @@ def query_get(q='*', s:int=0, i=None):
@app.push('/api/webhook')
def on_git_push():
log.info('Executing webhook for Gitea')
repo = Repo()
repo.remotes.origin.pull()
os.system('sudo systemctl restart paper-demo')
return 200
try:
repo = Repo()
repo.remotes.origin.pull()
os.system('sudo systemctl restart paper-demo')
return 200
except:
return 500