Merge "If we're going to apply acls, we need a dir"
diff --git a/jeepyb/cmd/create_hound_config.py b/jeepyb/cmd/create_hound_config.py
index 2fcc7fe..0911646 100644
--- a/jeepyb/cmd/create_hound_config.py
+++ b/jeepyb/cmd/create_hound_config.py
@@ -25,6 +25,7 @@
PROJECTS_YAML = os.environ.get('PROJECTS_YAML', '/home/hound/projects.yaml')
GIT_SERVER = os.environ.get('GIT_BASE', 'git.openstack.org')
DATA_PATH = os.environ.get('DATA_PATH', 'data')
+GIT_PROTOCOL = os.environ.get('GIT_PROTOCOL', 'git://')
def main():
@@ -32,9 +33,19 @@
projects = [entry['project'] for entry in registry.configs_list]
repos = {}
for project in projects:
- repos[os.path.basename(project)] = {
- 'url': "git://%(gitbase)s/%(project)s" % dict(
- gitbase=GIT_SERVER, project=project),
+ # Ignore attic and stackforge, those are repos that are not
+ # active anymore.
+ if project.startswith(['openstack-attic', 'stackforge']):
+ continue
+ basename = os.path.basename(project)
+ # ignore deb- projects that are forks of other projects intended for
+ # internal debian packaging needs only and are generally not of
+ # interest to upstream developers
+ if basename.startswith('deb-'):
+ continue
+ repos[basename] = {
+ 'url': "%(proto)s%(gitbase)s/%(project)s" % dict(
+ proto=GIT_PROTOCOL, gitbase=GIT_SERVER, project=project),
'url-pattern': {
'base-url': "http://%(gitbase)s/cgit/%(project)s"
"/tree/{path}{anchor}" % dict(gitbase=GIT_SERVER,
diff --git a/jeepyb/cmd/expire_old_reviews.py b/jeepyb/cmd/expire_old_reviews.py
index 9ec1064..5a62c05 100644
--- a/jeepyb/cmd/expire_old_reviews.py
+++ b/jeepyb/cmd/expire_old_reviews.py
@@ -74,7 +74,7 @@
for line in stdout:
row = json.loads(line)
- if 'rowCount' not in row:
+ if 'rowCount' not in row and 'open' in row and row['open']:
# Search for negative approvals
for approval in row['currentPatchSet']['approvals']:
if approval['value'] in ('-1', '-2'):
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 12fb2d2..5b482eb 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -176,7 +176,7 @@
return True
-def _get_group_uuid(group):
+def _get_group_uuid(group, retries=10):
"""
Gerrit keeps internal user groups in the DB while it keeps systems
groups in All-Projects groups file (in refs/meta/config). This
@@ -189,7 +189,7 @@
"""
query = "SELECT group_uuid FROM account_groups WHERE name = %s"
con = jeepyb.gerritdb.connect()
- for x in range(10):
+ for x in range(retries):
cursor = con.cursor()
cursor.execute(query, (group,))
data = cursor.fetchone()
@@ -197,12 +197,13 @@
con.commit()
if data:
return data[0]
- time.sleep(1)
+ if retries > 1:
+ time.sleep(1)
return None
def get_group_uuid(gerrit, group):
- uuid = _get_group_uuid(group)
+ uuid = _get_group_uuid(group, retries=1)
if uuid:
return uuid
if group in GERRIT_SYSTEM_GROUPS:
@@ -291,44 +292,51 @@
except KeyError:
# We do not have control of this github org ignore the project.
return False
+
try:
+ log.info("Fetching github info about %s", repo_name)
repo = org.get_repo(repo_name)
except github.GithubException:
+ log.info("Creating %s in github", repo_name)
repo = org.create_repo(repo_name,
homepage=homepage,
has_issues=has_issues,
has_downloads=has_downloads,
has_wiki=has_wiki)
- cache['created-in-github'] = True
- cache['has_wiki'] = has_wiki
- cache['has_downloads'] = has_downloads
- cache['has_issues'] = has_issues
-
created = True
- kwargs = {}
- # If necessary, update project on Github
- if description and description != repo.description:
- kwargs['description'] = description
- if homepage and homepage != repo.homepage:
- kwargs['homepage'] = homepage
- if has_issues != repo.has_issues:
- kwargs['has_issues'] = has_issues
- if has_downloads != repo.has_downloads:
- kwargs['has_downloads'] = has_downloads
- if has_wiki != repo.has_wiki:
- kwargs['has_wiki'] = has_wiki
+ cache['created-in-github'] = True
+ cache['has_wiki'] = has_wiki
+ cache['has_downloads'] = has_downloads
+ cache['has_issues'] = has_issues
+ kwargs = {}
+ # If necessary, update project on Github
+ if description and description != repo.description:
+ kwargs['description'] = description
+ if homepage and homepage != repo.homepage:
+ kwargs['homepage'] = homepage
+ if has_issues != repo.has_issues:
+ kwargs['has_issues'] = has_issues
+ if has_downloads != repo.has_downloads:
+ kwargs['has_downloads'] = has_downloads
+ if has_wiki != repo.has_wiki:
+ kwargs['has_wiki'] = has_wiki
+
+ if kwargs:
+ log.info("Updating github repo info about %s", repo_name)
repo.edit(repo_name, **kwargs)
- cache.update(kwargs)
+ cache.update(kwargs)
- if cache.get('gerrit-in-team', False):
+ if not cache.get('gerrit-in-team', False):
if 'gerrit' not in [team.name for team in repo.get_teams()]:
+ log.info("Adding gerrit to github team for %s", repo_name)
teams = org.get_teams()
teams_dict = dict(zip([t.name.lower() for t in teams], teams))
teams_dict['gerrit'].add_to_repos(repo)
cache['gerrit-in-team'] = True
+ created = True
return created
@@ -413,7 +421,11 @@
'/var/lib/jeepyb')
ACL_DIR = registry.get_defaults('acl-dir')
GERRIT_HOST = registry.get_defaults('gerrit-host')
+ GITREVIEW_GERRIT_HOST = registry.get_defaults(
+ 'gitreview-gerrit-host', GERRIT_HOST)
GERRIT_PORT = int(registry.get_defaults('gerrit-port', '29418'))
+ GITREVIEW_GERRIT_PORT = int(registry.get_defaults(
+ 'gitreview-gerrit-port', GERRIT_PORT))
GERRIT_USER = registry.get_defaults('gerrit-user')
GERRIT_KEY = registry.get_defaults('gerrit-key')
GERRIT_GITID = registry.get_defaults('gerrit-committer')
@@ -446,7 +458,6 @@
project_list = gerrit.listProjects()
ssh_env = u.make_ssh_wrapper(GERRIT_USER, GERRIT_KEY)
try:
-
for section in registry.configs_list:
project = section['project']
if args.projects and project not in args.projects:
@@ -503,8 +514,8 @@
# Make Local repo
push_string = u.make_local_copy(
repo_path, project, project_list,
- git_opts, ssh_env, upstream, GERRIT_HOST,
- GERRIT_PORT, project_git, GERRIT_GITID)
+ git_opts, ssh_env, upstream, GITREVIEW_GERRIT_HOST,
+ GITREVIEW_GERRIT_PORT, project_git, GERRIT_GITID)
description = (
find_description_override(repo_path)