#4030 AttributeError: 'Repository' object has no attribute 'branches'
Closed: Fixed 5 years ago Opened 5 years ago by ark74.

When editing any issue I'm seeing this,

trisquel 8 / buntu 16.04 based:
- pagure - commit dd1ea30
- python 3.5.2
- pagure celery worker
- gitolite celery worker
- postgresql
- virtual environment = /opt/pag_01/pag_01-server/venv

venv/bin/pip freeze
alembic==1.0.3
amqp==2.3.2
arrow==0.12.1
asn1crypto==0.24.0
bcrypt==3.1.4
billiard==3.5.0.4
binaryornot==0.4.4
bleach==3.0.2
blinker==1.4
celery==4.2.1
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
Click==7.0
cryptography==2.4.1
defusedxml==0.5.0
docutils==0.14
Flask==1.0.2
Flask-WTF==0.14.2
idna==2.7
itsdangerous==1.1.0
Jinja2==2.10
kitchen==1.2.5
kombu==4.2.1
Mako==1.0.7
Markdown==2.6.11
MarkupSafe==1.1.0
munch==2.3.2
Pillow==5.3.0
pkg-resources==0.0.0
psutil==5.4.8
psycopg2==2.7.6.1
pycparser==2.19
pygit2==0.24.0
python-dateutil==2.7.5
python-editor==1.0.3
python-openid-cla==1.2
python-openid-teams==1.1
python3-openid==3.1.0
pytz==2018.7
redis==2.10.6
requests==2.20.1
six==1.11.0
SQLAlchemy==1.2.14
straight.plugin==1.5.0
urllib3==1.24.1
vine==1.1.4
webencodings==0.5.1
Werkzeug==0.14.1
WTForms==2.2.1

Error trace:

[ERROR] celery.app.trace: Task pagure.lib.tasks.update_git[89268b99-b62f-4350-90f9-a8e1a9694921] raised unexpected: AttributeError("'Repository' object has no attribute 'branches'",)
Traceback (most recent call last):
File "/opt/pag_01/pag_01-server/venv/lib/python3.5/site-packages/celery/app/trace.py", line 382, in trace_task
R = retval = fun(args, kwargs)
File "/opt/pag_01/pag_01-server/venv/lib/python3.5/site-packages/celery/app/trace.py", line 641, in protected_call
return self.run(*args,
kwargs)
File "/opt/pag_01/pag_01-server/pagure/lib/tasks_utils.py", line 36, in decorated_function
return function(self, session,
args, **kwargs)
File "/opt/pag_01/pag_01-server/pagure/lib/tasks.py", line 341, in update_git
result = pagure.lib.git._update_git(obj, project)
File "/opt/pag_01/pag_01-server/pagure/lib/git.py", line 219, in _update_git
with TemporaryClone(repo, obj.repotype, "update_git") as tempclone:
File "/opt/pag_01/pag_01-server/pagure/lib/git.py", line 951, in enter
for branchname in self.repo.branches.remote:
AttributeError: 'Repository' object has no attribute 'branches'

Seems like this issue prevents updating/reloading the page with the content written on the issue, but if the page is manually reloaded you can see the issue/comment updated.

Please let me know if you need any additional info.
Cheers!


Indeed, it was the use of pygit2==0.24.x

Backporting libgit2-dev_0.27.4 from Ubuntu 18.10 to 16.04 and upgrading venv pygit2 to 0.27.2
Fixed the issue.

Still, backporting packages for servers is not ideal behavior.
Cheers!

Metadata Update from @ark74:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Metadata Update from @pingou:
- Issue status updated to: Open (was: Closed)

5 years ago

Metadata Update from @pingou:
- Issue assigned to pingou
- Issue set to the milestone: 5.2
- Issue tagged with: bug

5 years ago

Do you have by any chances access to a 0.26.0+ ?

Ubuntu has 3 LTS releases active.
14.04 - 0.19.0
16.04/(trisquel 8) - 0.24.1
18.04 - 0.26.0

It can be backported from 18.04 (safer than 18.10).

Any chance you could test it on 18.04?
We've discussed in the past bumping the requirement to 0.26+
I wonder if it's time we reconsider this

Metadata Update from @pingou:
- Issue untagged with: bug
- Issue set to the milestone: None (was: 5.2)

5 years ago

Metadata Update from @pingou:
- Issue set to the milestone: 5.2
- Issue tagged with: bug

5 years ago

Then it should be pygit2==0.26.4 right?

I'll finish some new changes to the installer, check against 18.04 and report back.

I can confirm that using

pygit2
- 0.26.4
- 0.27.2

Prevents this issue, so for trisquel it would be necessary to backport libgit2-dev from 18.04 -> 16.04, thus trisquel 8.

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #4094 Merged 5 years ago