Only add 'groups' file to the repo if it exists

The 'groups' file gets created only if there are groups mentioned in
the 'project.config' file.  A 'project.config' file is not required to
mention any groups, thus we should only attempt to add the 'groups' file
if it exists.

Change-Id: I333df5156bc27db29143ee412d86e12606faa751
This commit is contained in:
Timothy Chavez 2015-06-04 18:18:51 -05:00
parent bee95e5e63
commit f3c58c1c43

View File

@ -247,10 +247,10 @@ def create_groups_file(project, gerrit, repo_path):
with open(group_file, 'w') as fp: with open(group_file, 'w') as fp:
for group, uuid in uuids.items(): for group, uuid in uuids.items():
fp.write("%s\t%s\n" % (uuid, group)) fp.write("%s\t%s\n" % (uuid, group))
status = git_command(repo_path, "add groups") status = git_command(repo_path, "add groups")
if status != 0: if status != 0:
log.error("Failed to add groups file for project: %s" % project) log.error("Failed to add groups file for project: %s" % project)
raise CreateGroupException() raise CreateGroupException()
def make_ssh_wrapper(gerrit_user, gerrit_key): def make_ssh_wrapper(gerrit_user, gerrit_key):