summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-06-21 14:45:17 +0000
committerHolger Levsen <holger@layer-acht.org>2015-07-05 15:07:56 +0200
commit9b7b7c740f82bc46e98942fee3ba3065bf4093dc (patch)
tree5b3e97bfe598716a76e620c9730a892ecc7a5dff /bin
parent5d4a6d8dc1f82f0f39297ca827dbdd85c299aa03 (diff)
downloadjenkins.debian.net-9b7b7c740f82bc46e98942fee3ba3065bf4093dc.tar.xz
reproducible: reschedule: add a --dry-run option to do exactly that (doh!)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_remote_scheduler.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 79b60542..ad29f6b6 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -18,6 +18,7 @@ parser = argparse.ArgumentParser(
' IRC channel unless -n is provided.\nSpecifying both -r and -i ' +
'means "all packages with that issue AND that status"')
group = parser.add_mutually_exclusive_group()
+parser.add_argument('--dry-run', action='store_true')
group.add_argument('-a', '--artifacts', default=False, action='store_true',
help='Save artifacts (for further offline study)')
group.add_argument('-n', '--no-notify', default=False, action='store_true',
@@ -81,8 +82,10 @@ packages = scheduling_args.packages
artifacts = scheduling_args.artifacts
notify = not scheduling_args.no_notify or scheduling_args.noisy
debug_url = scheduling_args.noisy
+dry_run = scheduling_args.dry_run
log.debug('Requester: ' + requester)
+log.debug('Dry run: ' + str(dry_run))
log.debug('Local call: ' + str(local))
log.debug('Reason: ' + reason)
log.debug('Artifacts: ' + str(artifacts))
@@ -229,13 +232,17 @@ query1 = '''REPLACE INTO schedule
query2 = '''INSERT INTO manual_scheduler
(package_id, requester, date_request) VALUES (?, ?, ?)'''
-cursor = conn_db.cursor()
-cursor.executemany(query1, to_schedule)
-cursor.executemany(query2, save_schedule)
-conn_db.commit()
+if not dry_run:
+ cursor = conn_db.cursor()
+ cursor.executemany(query1, to_schedule)
+ cursor.executemany(query2, save_schedule)
+ conn_db.commit()
+else:
+ log.info('Ran with --dry-run, I did scheduled nothing')
log.info(bcolors.GOOD + message + bcolors.ENDC)
if not (local and requester == "jenkins maintenance job") and len(ids) != 0:
- irc_msg(message)
+ if not dry_run:
+ irc_msg(message)
generate_schedule() # the html page