Add parameters for scripts that talk to Gerrit
Not all gerrit installations are configured the same. This adds parameters
to the gerrit sync script and expire script so that it can work from the
command line and cron on all servers.
Fixes bug #994201
Change-Id: Iac37e18aaf7a10fb5594be233e33b000eabed336
diff --git a/expire_old_reviews.py b/expire_old_reviews.py
index 89686c8..1ba936e 100644
--- a/expire_old_reviews.py
+++ b/expire_old_reviews.py
@@ -22,10 +22,15 @@
import paramiko
import json
import logging
+import argparse
-GERRIT_USER = os.environ.get('GERRIT_USER', 'launchpadsync')
-GERRIT_SSH_KEY = os.environ.get('GERRIT_SSH_KEY',
- '/home/gerrit2/.ssh/launchpadsync_rsa')
+parser = argparse.ArgumentParser()
+parser.add_argument('user', help='The gerrit admin user')
+parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
+options = parser.parse_args()
+
+GERRIT_USER = options.user
+GERRIT_SSH_KEY = options.ssh_key
logging.basicConfig(format='%(asctime)-6s: %(name)s - %(levelname)s - %(message)s', filename='/var/log/gerrit/expire_reviews.log')
logger= logging.getLogger('expire_reviews')