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
This commit is contained in:
Monty Taylor 2020-04-10 11:49:49 -05:00
parent 77bed1ae7a
commit 5567a02437
5 changed files with 12 additions and 11 deletions

View File

@ -48,7 +48,8 @@ from jeepyb import projects
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 impacted(git_log, impact_string):
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]

View File

@ -31,7 +31,8 @@ import pymysql
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 @@ def get_broken_config(filename):
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 update_spec(launchpad, project, name, subject, link, topic=None):
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],

View File

@ -30,7 +30,8 @@ from jeepyb import projects as p
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 find_bugs(launchpad, git_log, args):
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]

View File

@ -33,8 +33,6 @@ import paramiko
import jeepyb.gerritdb
import jeepyb.log as l
BASE_DIR = '/home/gerrit2/review_site'
logger = logging.getLogger('welcome_reviews')

View File

@ -35,7 +35,7 @@ def get_broken_config(filename):
text += line.lstrip()
fp = six.StringIO(text)
c = configparser.ConfigParser()
c = configparser.ConfigParser(strict=False)
c.readfp(fp)
return c