Fix issues from rolling out containers
We need to be able to set the location of GERRIT_GIT_DIR via
env vars. And we need to turn off strict for config parser.
Change-Id: I9d511caa6db6f958a215f131692e185c717b66d5
diff --git a/jeepyb/cmd/notify_impact.py b/jeepyb/cmd/notify_impact.py
index f30f042..1cc76c9 100644
--- a/jeepyb/cmd/notify_impact.py
+++ b/jeepyb/cmd/notify_impact.py
@@ -48,7 +48,8 @@
logger = logging.getLogger('notify_impact')
DOC_TAG = "doc"
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+ 'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
EMAIL_TEMPLATE = """
Hi, I'd like you to take a look at this patch for potential
%s.
@@ -241,7 +242,7 @@
def extract_git_log(args):
"""Extract git log of all merged commits."""
cmd = ['git',
- '--git-dir=' + BASE_DIR + '/git/' + args.project + '.git',
+ '--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
'log', '--no-merges', args.commit + '^1..' + args.commit]
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
diff --git a/jeepyb/cmd/update_blueprint.py b/jeepyb/cmd/update_blueprint.py
index c1fd98a..0b1e44c 100644
--- a/jeepyb/cmd/update_blueprint.py
+++ b/jeepyb/cmd/update_blueprint.py
@@ -31,7 +31,8 @@
from jeepyb import projects as p
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+ 'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
GERRIT_CACHE_DIR = os.path.expanduser(
os.environ.get('GERRIT_CACHE_DIR',
'~/.launchpadlib/cache'))
@@ -55,7 +56,7 @@
text = "%s%s" % (text, line.lstrip())
fp = six.StringIO(text)
- c = configparser.ConfigParser()
+ c = configparser.ConfigParser(strict=False)
c.readfp(fp)
return c
@@ -107,8 +108,8 @@
def find_specs(launchpad, dbconn, args):
- git_dir_arg = '--git-dir={base_dir}/git/{project}.git'.format(
- base_dir=BASE_DIR,
+ git_dir_arg = '--git-dir={base_dir}/{project}.git'.format(
+ base_dir=GERRIT_GIT_DIR,
project=args.project)
git_log = subprocess.Popen(['git', git_dir_arg, 'log', '--no-merges',
args.commit + '^1..' + args.commit],
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index 212ee7a..0278aaa 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -30,7 +30,8 @@
from jeepyb import utils as u
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+ 'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
GERRIT_CACHE_DIR = os.path.expanduser(
os.environ.get('GERRIT_CACHE_DIR',
'~/.launchpadlib/cache'))
@@ -332,7 +333,7 @@
def extract_git_log(args):
"""Extract git log of all merged commits."""
cmd = ['git',
- '--git-dir=' + BASE_DIR + '/git/' + args.project + '.git',
+ '--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
'log', '--no-merges', args.commit + '^1..' + args.commit]
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
diff --git a/jeepyb/cmd/welcome_message.py b/jeepyb/cmd/welcome_message.py
index 2b01a9b..b28f5e1 100644
--- a/jeepyb/cmd/welcome_message.py
+++ b/jeepyb/cmd/welcome_message.py
@@ -33,8 +33,6 @@
import jeepyb.gerritdb
import jeepyb.log as l
-BASE_DIR = '/home/gerrit2/review_site'
-
logger = logging.getLogger('welcome_reviews')
diff --git a/jeepyb/gerritdb.py b/jeepyb/gerritdb.py
index b362240..8c06d2c 100644
--- a/jeepyb/gerritdb.py
+++ b/jeepyb/gerritdb.py
@@ -35,7 +35,7 @@
text += line.lstrip()
fp = six.StringIO(text)
- c = configparser.ConfigParser()
+ c = configparser.ConfigParser(strict=False)
c.readfp(fp)
return c