summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-08-21 20:39:39 -0400
committerHolger Levsen <holger@layer-acht.org>2016-08-22 08:36:35 +0200
commit0b537a2669243b2417c23e40864281c3b978f393 (patch)
tree6143bc3d5c2d5da1bf1476f77c0d925abf39c8de
parent591e8b4962f6cfc394e1b18c6a43dfc5783ffb52 (diff)
downloadjenkins.debian.net-0b537a2669243b2417c23e40864281c3b978f393.tar.xz
reproducible debian: fix sqlite3 IntegrityError
Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-xbin/reproducible_remote_scheduler.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 7f846c8b..6ba1f3a3 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -64,6 +64,7 @@ except KeyError:
'schedule packages. Ask in #debian-reproducible if you have '
'trouble with that.' + bcolors.ENDC)
sys.exit(1)
+
# this variable is set by reproducible scripts and so it only available in calls made on the local host (=main node)
try:
local = True if os.environ['LOCAL_CALL'] == 'true' else False
@@ -241,7 +242,8 @@ else:
do_notify = 0
schedule_table = db_table('schedule')
-existing_pkg_ids = dict(query_db(sql.select([
+if ids:
+ existing_pkg_ids = dict(query_db(sql.select([
schedule_table.c.package_id,
schedule_table.c.id,
]).where(schedule_table.c.package_id.in_(ids))))
@@ -281,11 +283,12 @@ insert_manual_query = db_table('manual_scheduler').insert()
if not dry_run:
transaction = conn_db.begin()
- if len(add_to_schedule):
+ if add_to_schedule:
conn_db.execute(insert_schedule_query, add_to_schedule)
- if len(update_schedule):
+ if update_schedule:
conn_db.execute(update_schedule_query, update_schedule)
- conn_db.execute(insert_manual_query, save_schedule)
+ if save_schedule:
+ conn_db.execute(insert_manual_query, save_schedule)
transaction.commit()
else:
log.info('Ran with --dry-run, scheduled nothing')