Skip to content

Handle disabled repositories

It is possible for a Git repo to be in a "disabled" state. Being disabled means that the repo cannot be cloned as there are no OAuthCredentials available for them; the frontend displays a red disabled badge on any repo affected in this way.

Currently, retrieving a disabled repository as an internal user causes an AttributeError 'NoneType' object has no attribute 'token', since RepositorySerializer.get_gitlab_token does not take disabled repos into account: https://sentry.io/organizations/teklia/issues/1747325948/

The API should instead just return None and the Git import task should fail gracefully. It is not impossible that this issue has been overlooked in different places.

Edited by Erwan Rouchet