#2023 Fix the error: 'Project' object has no attribute 'ci_hook'
Merged by pingou. Opened by pingou.
fix_backref  into  master

Download 2023.patch

Since 2.13.1, we were running into this error:
AttributeError: 'Project' object has no attribute 'ci_hook'
on a regular basis, when creating a new PR or when commenting on one, but
not regular comment, just notification.
In both of these situations, and on pagure.io that has the jenkins
integration turned on, we notify the pagure-ci service that there was a
change to the PR that should be tested.

However, nowhere in the code did we load pagure.hooks.pagure_ci which
contains the definition of the PagureCiTable having the backref from
that table to Project and named it ci_hook.
This was working in 2.13 and not in 2.13.1 because in the commit:
867097dc25bea470ed3d53cbd28c390e22d52b01
We ran flake8 to clean the pagure.lib module and we removed that import.

Simply bringing back this import and make it ignored of flake8 solves
our problem.

Two things:

  • I have looked at making unit-tests for this but I did not manage to replicate the issue in tests :(

  • This has been hotfixed in prod because it was getting quite annoying :)

rebased

This is one of those trivial bugs which are very annoying so :thumbsup: for this fix.

Thanks for the review :)

rebased

Pull-Request has been merged by pingou

Metadata