summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2014-11-21 14:10:39 -0600
committerAndy Doan <andy.doan@linaro.org>2014-11-21 14:10:39 -0600
commita44089f57dc7de35d9ebccc95a54af173c154de3 (patch)
tree25dfbc50ea9187531230c9eecfb743e7173ba852
parent4fadafc79b99d3f6c604ed201585acd07850dce1 (diff)
allow cron script to exit with an error
We were missing errors in the script. This should hopefully surface them. Change-Id: I1cfd97a35c669d1bb022a3af5682c9f9dac3ade0
-rwxr-xr-xapps/patchwork/bin/update-committed-patches.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/patchwork/bin/update-committed-patches.py b/apps/patchwork/bin/update-committed-patches.py
index c10aad3..5fe1755 100755
--- a/apps/patchwork/bin/update-committed-patches.py
+++ b/apps/patchwork/bin/update-committed-patches.py
@@ -50,12 +50,15 @@ def main():
projects = Project.objects.exclude(
Q(source_tree__isnull=True) | Q(source_tree=''))
+ rc = 1
with cache_db:
- _update(crwd, projects, cache_db)
+ rc = _update(crwd, projects, cache_db)
+ return rc
def _update(crwd, projects, cache_db):
print "Total number of projects: {0}".format(len(projects))
+ rc = 0
for project in projects:
print "=" * 80
@@ -65,6 +68,7 @@ def _update(crwd, projects, cache_db):
root = ensure_source_checkout_for_project(project)
except GitException, e:
sys.stderr.write(str(e) + "\n")
+ rc = 1
continue
patches_accepted = 0
@@ -136,6 +140,7 @@ def _update(crwd, projects, cache_db):
print "{0} patches marked as accepted".format(patches_accepted)
print "{0} patches marked as superseded".format(patches_superseded)
print "=" * 80, "\n"
+ return rc
lock = FileLock('/var/lock/update-committed-patches')
@@ -148,6 +153,6 @@ except LockTimeout:
"can't acquire lock.\n")
else:
try:
- main()
+ sys.exit(main())
finally:
lock.release()