#22 Failure trying to push issues repo back to pagure
Closed: Fixed 7 years ago Opened 7 years ago by ryanlerch.

I tried to import the issues from the fedora elections trac:
https://fedorahosted.org/elections/

And the import seemed to work okay, but when it tried to push the results back to the repo i set up on stg.pagure.io, i got the following error from the hook. A few issues did seem to get created though (https://stg.pagure.io/fedora-elections/issues)

remote: To load: b89566adb37544e7b0f62e94578b9810 
remote: Traceback (most recent call last):
remote:   File "./hooks/post-receive.pagure-ticket", line 97, in <module>
remote:     main(sys.argv[1:])
remote:   File "./hooks/post-receive.pagure-ticket", line 93, in main
remote:     run_as_post_receive_hook()
remote:   File "./hooks/post-receive.pagure-ticket", line 89, in run_as_post_receive_hook
remote:     json_data=json_data)
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/git.py", line 500, in    update_ticket_from_git
remote:     float(comment['date_created'])),
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 254, in add_issue_comment
remote:     'comment_added': text2markdown(issue_comment.comment),remote: To load: b89566adb37544e7b0f62e94578b9810
remote: Traceback (most recent call last):
remote:   File "./hooks/post-receive.pagure-ticket", line 97, in <module>
remote:     main(sys.argv[1:])
remote:   File "./hooks/post-receive.pagure-ticket", line 93, in main
remote:     run_as_post_receive_hook()
remote:   File "./hooks/post-receive.pagure-ticket", line 89, in run_as_post_receive_hook
remote:     json_data=json_data)
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/git.py", line 500, in update_ticket_from_git
remote:     float(comment['date_created'])),
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 254, in add_issue_comment
remote:     'comment_added': text2markdown(issue_comment.comment),
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 2674, in text2markdown
remote:     return clean_input(md.convert('\n'.join(ntext)))
remote:   File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 295, in convert
remote:     newRoot = treeprocessor.run(root)
remote:   File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 284, in run
remote:     text), child)
remote:   File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 105, in __handleInline
remote:     data, patternIndex, startIndex)
remote:   File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 232, in __applyPattern
remote:     node = pattern.handleMatch(match)
remote:   File "/usr/lib/python2.7/site-packages/pagure/pfmarkdown.py", line 52, in handleMatch
remote:     url = flask.url_for('view_user', username=name)
remote:   File "/usr/lib/python2.7/site-packages/flask/helpers.py", line 258, in url_for
remote:     raise RuntimeError('Attempted to generate a URL without the '
remote: RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.
remote: Hook ./hooks/post-receive.pagure-ticket failed with error code 1
To ssh://git@stg.pagure.io/tickets/fedora-elections.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

I had a look at this issue, but could not reproduce it running pagure locally (./runserver .py). However I did notice that the pagure project only had 43 issues instead of 44 in fedorahosted.

I am not quite sure why yet but issue 1 was not imported into pagure, although it is present in the ticket git repo.

I ll spend more time on this later this week.

I have managed to reproduce this issue, basically there a comment in trac with the @username and pagure tries to generate the link to the username during the import/markdown conversion of the comment.

It fails when trying to generate the url 'Attempted to generate a URL without the application context'. I need to check out How the app context works in flask, so I can fix this :smile:

For what it's worth, I'm also experiencing this problem with the Marketing team Trac. I'll be happy to test a fix once made available. For now, here is my stacktrace, in case it is of any use.

$ pgimport push stg-fedora-marketing.git
remote: Files changed by new commits:
remote:
remote: repo: stg-fedora-marketing None
[ ... ]
remote: To load: ce9f2abbb0fe4115adab0e6a4ca31992
remote: Traceback (most recent call last):
remote: File "./hooks/post-receive.pagure-ticket", line 97, in <module>
remote: main(sys.argv[1:])
remote: File "./hooks/post-receive.pagure-ticket", line 93, in main
remote: run_as_post_receive_hook()
remote: File "./hooks/post-receive.pagure-ticket", line 89, in run_as_post_receive_hook
remote: json_data=json_data)
remote: File "/usr/lib/python2.7/site-packages/pagure/lib/git.py", line 500, in update_ticket_from_git
remote: float(comment['date_created'])),
remote: File "/usr/lib/python2.7/site-packages/pagure/lib/init.py", line 254, in add_issue_comment
remote: 'comment_added': text2markdown(issue_comment.comment),
remote: File "/usr/lib/python2.7/site-packages/pagure/lib/init.py", line 2674, in text2markdown
remote: return clean_input(md.convert('\n'.join(ntext)))
remote: File "/usr/lib/python2.7/site-packages/markdown/init.py", line 295, in convert
remote: newRoot = treeprocessor.run(root)
remote: File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 284, in run
remote: text), child)
remote: File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 105, in __handleInline
remote: data, patternIndex, startIndex)
remote: File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 232, in __applyPattern
remote: node = pattern.handleMatch(match)
remote: File "/usr/lib/python2.7/site-packages/pagure/pfmarkdown.py", line 52, in handleMatch
remote: url = flask.url_for('view_user', username=name)
remote: File "/usr/lib/python2.7/site-packages/flask/helpers.py", line 258, in url_for
remote: raise RuntimeError('Attempted to generate a URL without the '
remote: RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available.
remote: Hook ./hooks/post-receive.pagure-ticket failed with error code 1
To ssh://git@stg.pagure.io/tickets/stg-fedora-marketing.git
* [new branch] master -> master

As discussed with @pingou this is an issue in pagure which might be already fixed in the master branch of pagure.
I ll do some test running the latest pagure locally to see if the issue is still present or not .

@ryanlerch , @jflory7 this should be fixed in the new pagure release 2.4. You have a try on the pagure stg.

I have tested it with ryan election repo, https://stg.pagure.io/elections/issues

Discussed in #fedora-apps yesterday, but confirming here. The Marketing Trac imported perfectly. :smile:

Closing this issue, as this was fixed by pagure 2.4 release

@cverna changed the status to Fixed

7 years ago

Login to comment on this ticket.

Metadata