#52 [fedorahosted] Allow import of issues if the pagure project already has some issues
Closed: Fixed 7 years ago Opened 7 years ago by vivekanand1101.

Currently, we are giving the id in the importer itself which can clash with the id that sqlalchemy has already given to some other issue.


This would be helpful for some of the releng projects that migrated to pagure and picked up a few issues there.
ie, it would be fine if we renumber the existing pagure issues to the end of the ones we import from fedorahosted.

ccing @ausil on this

FYI, this is the traceback you get when you try and push an import into a ticket repo that already has tickets in it:

 remote: Traceback (most recent call last):        
 remote:   File "./hooks/post-receive.pagure-ticket", line 105, in <module>        
 remote:     main(sys.argv[1:])        
 remote:   File "./hooks/post-receive.pagure-ticket", line 101, in main        
 remote:     run_as_post_receive_hook()        
 remote:   File "./hooks/post-receive.pagure-ticket", line 97, in run_as_post_receive_hook        
 remote:     json_data=json_data)        
 remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/git.py", line 454, in update_ticket_from_git        
 remote:     notify=False,        
 remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 1198, in new_issue        
 remote:     session.flush()        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 150, in do        
 remote:     return getattr(self.registry(), name)(*args, **kwargs)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1919, in flush        
 remote:     self._flush(objects)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2037, in _flush        
 remote:     transaction.rollback(_capture_exception=True)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__        
 remote:     compat.reraise(exc_type, exc_value, exc_tb)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2001, in _flush        
 remote:     flush_context.execute()        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute        
 remote:     rec.execute(self)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 526, in execute        
 remote:     uow        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 65, in save_obj        
 remote:     mapper, table, insert)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 570, in _emit_insert_statements        
 remote:     execute(statement, multiparams)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute        
 remote:     return meth(self, multiparams, params)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection        
 remote:     return connection._execute_clauseelement(self, multiparams, params)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 826, in _execute_clauseelement        
 remote:     compiled_sql, distilled_params        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context        
 remote:     context)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1159, in _handle_dbapi_exception        
 remote:     exc_info        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause        
 remote:     reraise(type(exception), exception, tb=exc_tb)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context        
 remote:     context)        
 remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute        
 remote:     cursor.execute(statement, parameters)        
 remote: sqlalchemy.exc.IntegrityError: (IntegrityError) duplicate key value violates unique constraint "issues_pkey"        
 remote: DETAIL:  Key (id, project_id)=(2, 158) already exists.        
 remote:  'INSERT INTO issues (id, uid, project_id, title, content, user_id, assignee_id, status, private, priority, milestone, close_status, date_created, closed_at) VALUES (%(id)s, %(uid)s, %(project_id)s, %(title)s, %(content)s, %(user_id)s, %(assignee_id)s, %(status)s, %(private)s, %(priority)s, %(milestone)s, %(close_status)s, %(date_created)s, %(closed_at)s)' {'status': u'Open', 'content': u'When updating a spec file to a new source, but before the new source has been uploaded, rpkg may wind up needlessly downloading the source file in sources.  It should perhaps peek at the spec file and decide if a new source file is already downloaded.  Or something...?', 'user_id': 110, 'uid': '26197a719ab54c73b5e6ea82abb42295', 'title': u'sources needlessly downloads old source file', 'private': False, 'close_status': None, 'assignee_id': None, 'milestone': None, 'date_created': datetime.datetime(2011, 7, 22, 2, 40, 38), 'project_id': 158, 'closed_at': None, 'id': 2, 'priority': None}        
 remote: Hook ./hooks/post-receive.pagure-ticket failed with error code 1

@cverna changed the status to Closed

7 years ago

Login to comment on this ticket.

Metadata