#2874 Merges commitmsg failed with `permission denied for relation pull_request_comments`
Opened 2 years ago by ignatenkobrain. Modified 2 years ago

Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 652 bytes | 652.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Emitting a message to the fedmsg bus.
remote: * Publishing information for 1 commits
remote: Sending to redis to log activity and send commit notification emails
remote: Detailed log of new commits:
remote: 
remote: 
remote: * commit 44999111a1774927e925d1f9cdc464942e5d421d
remote: * Author: Igor Gnatenko <ignatenko@redhat.com>
remote: * Date:   Wed Jan 3 11:51:15 2018 +0100
remote: * 
remote: * python -> python2; %systemd_requires
remote: * 
remote: * Merges: https://src.fedoraproject.org/rpms/dnf/pull-request/5
remote: 2018-01-03 10:52:29,198 [ERROR] __main__: (ProgrammingError) permission denied for relation pull_request_comments
remote:  'INSERT INTO pull_request_comments (pull_request_uid, commit_id, user_id, filename, line, tree_id, comment, parent_id, notification, edited_on, editor_id, date_created) VALUES (%(pull_request_uid)s, %(commit_id)s, %(user_id)s, %(filename)s, %(line)s, %(tree_id)s, %(comment)s, %(parent_id)s, %(notification)s, %(edited_on)s, %(editor_id)s, %(date_created)s) RETURNING pull_request_comments.id' {'commit_id': None, 'comment': u' Commit [44999111](https://src.fedoraproject.org/rpms/dnf/c/44999111) fixes this pull-request', 'user_id': 564, 'pull_request_uid': u'66a6a2d05b0746a09c901ccff9bbcda0', 'notification': False, 'filename': None, 'parent_id': None, 'edited_on': None, 'tree_id': None, 'date_created': datetime.datetime(2018, 1, 3, 10, 52, 29, 190681), 'line': None, 'editor_id': None}
remote: Traceback (most recent call last):
remote:   File "/usr/lib/python2.7/site-packages/pagure/hooks/files/pagure_hook.py", line 138, in fixes_relation
remote:     requestfolder=pagure.APP.config['REQUESTS_FOLDER'],
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 1210, in add_pull_request_comment
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 602, in _emit_insert_statements
remote:     execute(statement, params)
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: ProgrammingError: (ProgrammingError) permission denied for relation pull_request_comments
remote:  'INSERT INTO pull_request_comments (pull_request_uid, commit_id, user_id, filename, line, tree_id, comment, parent_id, notification, edited_on, editor_id, date_created) VALUES (%(pull_request_uid)s, %(commit_id)s, %(user_id)s, %(filename)s, %(line)s, %(tree_id)s, %(comment)s, %(parent_id)s, %(notification)s, %(edited_on)s, %(editor_id)s, %(date_created)s) RETURNING pull_request_comments.id' {'commit_id': None, 'comment': u' Commit [44999111](https://src.fedoraproject.org/rpms/dnf/c/44999111) fixes this pull-request', 'user_id': 564, 'pull_request_uid': u'66a6a2d05b0746a09c901ccff9bbcda0', 'notification': False, 'filename': None, 'parent_id': None, 'edited_on': None, 'tree_id': None, 'date_created': datetime.datetime(2018, 1, 3, 10, 52, 29, 190681), 'line': None, 'editor_id': None}
remote: ERROR (ProgrammingError) permission denied for relation pull_requests
remote:  'UPDATE pull_requests SET status=%(status)s, closed_by_id=%(closed_by_id)s, closed_at=%(closed_at)s, last_updated=%(last_updated)s WHERE pull_requests.id = %(pull_requests_id)s AND pull_requests.project_id = %(pull_requests_project_id)s' {'status': 'Merged', 'last_updated': datetime.datetime(2018, 1, 3, 10, 52, 29, 324043), 'closed_by_id': 564, 'pull_requests_id': 5, 'pull_requests_project_id': 2599, 'closed_at': datetime.datetime(2018, 1, 3, 10, 52, 29, 315583)}
remote: 2018-01-03 10:52:29,326 [ERROR] __main__: (ProgrammingError) permission denied for relation pull_requests
remote:  'UPDATE pull_requests SET status=%(status)s, closed_by_id=%(closed_by_id)s, closed_at=%(closed_at)s, last_updated=%(last_updated)s WHERE pull_requests.id = %(pull_requests_id)s AND pull_requests.project_id = %(pull_requests_project_id)s' {'status': 'Merged', 'last_updated': datetime.datetime(2018, 1, 3, 10, 52, 29, 324043), 'closed_by_id': 564, 'pull_requests_id': 5, 'pull_requests_project_id': 2599, 'closed_at': datetime.datetime(2018, 1, 3, 10, 52, 29, 315583)}
remote: Traceback (most recent call last):
remote:   File "/usr/lib/python2.7/site-packages/pagure/hooks/files/pagure_hook.py", line 161, in fixes_relation
remote:     merged=True)
remote:   File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 2760, in close_pull_request
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 60, in save_obj
remote:     mapper, table, update)
remote:   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 518, in _emit_update_statements
remote:     execute(statement, params)
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: ProgrammingError: (ProgrammingError) permission denied for relation pull_requests
remote:  'UPDATE pull_requests SET status=%(status)s, closed_by_id=%(closed_by_id)s, closed_at=%(closed_at)s, last_updated=%(last_updated)s WHERE pull_requests.id = %(pull_requests_id)s AND pull_requests.project_id = %(pull_requests_project_id)s' {'status': 'Merged', 'last_updated': datetime.datetime(2018, 1, 3, 10, 52, 29, 324043), 'closed_by_id': 564, 'pull_requests_id': 5, 'pull_requests_project_id': 2599, 'closed_at': datetime.datetime(2018, 1, 3, 10, 52, 29, 315583)}
remote: * Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
To ssh://pkgs.fedoraproject.org/rpms/dnf
   554b09e..4499911  master -> master

Ok, I know why this is.

For security reasons, on dist-git the pagure hooks only have read only access to the DB thus failing to update the table.

This will require some re-factoring of the code to fix it.

Metadata Update from @pingou:
- Issue tagged with: bug

2 years ago

Metadata Update from @pingou:
- Issue set to the milestone: 5.3

2 years ago

So it turns out that #4072 is not fixable (at all) which means this ticket won't be fixed by 5.3 as well.

Adjusting the milestone for it as such.

Metadata Update from @pingou:
- Issue set to the milestone: Coming 3 months (was: 5.3)

2 years ago

Login to comment on this ticket.

Metadata