# HG changeset patch # User Mads Kiilerich # Date 2020-11-20 16:10:30 # Node ID 8c781cb03412d4d07c067118f38c2fcc23d7df1e # Parent 5de682ee0b0621dc73539a944518cdee6404eb9b repo-scan: log error and continue after failure creating a scanned repo Continue after for example: Exception: invalid repo name Foo diff --git a/kallithea/lib/utils.py b/kallithea/lib/utils.py --- a/kallithea/lib/utils.py +++ b/kallithea/lib/utils.py @@ -413,17 +413,22 @@ def repo2db_mapper(initial_repo_dict, re if repo.description != 'unknown' else '%s repository' % name) - new_repo = repo_model._create_repo( - repo_name=name, - repo_type=repo.alias, - description=desc, - repo_group=getattr(group, 'group_id', None), - owner=user, - enable_downloads=enable_downloads, - enable_statistics=enable_statistics, - private=private, - state=db.Repository.STATE_CREATED - ) + try: + new_repo = repo_model._create_repo( + repo_name=name, + repo_type=repo.alias, + description=desc, + repo_group=getattr(group, 'group_id', None), + owner=user, + enable_downloads=enable_downloads, + enable_statistics=enable_statistics, + private=private, + state=db.Repository.STATE_CREATED + ) + except Exception as e: + log.error('error creating %r: %s: %s', name, type(e).__name__, e) + sa.rollback() + continue sa.commit() # we added that repo just now, and make sure it has githook # installed, and updated server info