Changeset - 8c781cb03412
[Not reviewed]
default
0 1 0
Mads Kiilerich - 5 years ago 2020-11-20 16:10:30
mads@kiilerich.com
Grafted from: 516bf0770096
repo-scan: log error and continue after failure creating a scanned repo

Continue after for example:
Exception: invalid repo name Foo
1 file changed with 16 insertions and 11 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/utils.py
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)