Make local git dir creation optional

manage-projects unconditionally set up a local git dir even if the
config option was unset. We change that behavior because new gerrit url
paths make a local git dir option less straight forward. If you've set a
git dir path we'll continue to honor it, otherwise this step is skipped.

Depends-On: https://review.opendev.org/762196
Change-Id: I39ef5ba7cd8747d52487cb0252a9b12878d6247b
This commit is contained in:
Clark Boylan 2020-10-16 09:33:00 -07:00 committed by Clark Boylan
parent 6efdfe9f87
commit 454e31c4d7

View File

@ -431,7 +431,7 @@ def main():
default_has_github = registry.get_defaults('has-github', True)
LOCAL_GIT_DIR = registry.get_defaults('local-git-dir', '/var/lib/git')
LOCAL_GIT_DIR = registry.get_defaults('local-git-dir', None)
JEEPYB_CACHE_DIR = registry.get_defaults('jeepyb-cache-dir',
'/var/lib/jeepyb')
ACL_DIR = registry.get_defaults('acl-dir')
@ -550,9 +550,12 @@ def main():
gerrit.replicate(project)
# Create the repo for the local git mirror
create_local_mirror(
LOCAL_GIT_DIR, project_git,
GERRIT_OS_SYSTEM_USER, GERRIT_OS_SYSTEM_GROUP)
if LOCAL_GIT_DIR:
# This is conditional because new gerrit url pathing
# has made local git mirrors less straightfoward.
create_local_mirror(
LOCAL_GIT_DIR, project_git,
GERRIT_OS_SYSTEM_USER, GERRIT_OS_SYSTEM_GROUP)
if acl_config:
acl_sha = acl_cache.get(acl_config)