Repository: fedora-infra/bodhi

Issue:
Cannot request stable - 'failing to determine ACLs'
For this update:  https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-50448945cd

Something is screwy when I try to request stable.  Not sure what.  Perhaps we should sync prod data to stg and then try adding some debugging around it over there.



Discussion:
Hm, yeah when I try to push it to stable I get:

```
ACL validation mechanism was unable to determine ACLs.
```

I synced the prod db to stg, and then manually queued this one up for stable. We'll have to do further testing to figure out the root of the problem.

Logs from `bodhi02.stg`

```
request.validated = [Tue Mar 01 03:49:35.481741 2016] [:error] [pid 14380] 2016-03-01 03:49:35,232 DEBUG [bodhi][Dummy-1] {'csrf_token': u'<removed>', 'request': <stable>, 'update': <Update {'date_testing': None, 'old_updateid': None, 'pushed': False, 'require_testcases': True, 'date_stable': None, 'critpath': False, 'date_approved': None, 'stable_karma': 3, 'date_pushed': None, 'requirements': u'', 'severity': u'unspecified', 'title': u'python-fedora-0.7.1-2.el7', 'suggest': u'unspecified', 'require_bugs': True, 'comments': [{'bug_feedback': [], 'user_id': 91, 'text': u'This update has been submitted for testing by ralph. ', 'testcase_feedback': [], 'karma_critpath': 0, 'update_id': 48554, 'karma': 0, 'anonymous': False, 'timestamp': '2016-01-11 22:17:51', 'id': 375809, 'user': {'openid': None, 'name': u'bodhi', 'show_popups': True, 'id': 91, 'avatar': None, 'groups': [], 'email': None}}], 'updateid': u'FEDORA-EPEL-2016-184f2c8947', 'type': u'bugfix', 'close_bugs': True, 'status': u'pending', 'meets_testing_requirements': False, 'date_submitted': '2016-01-11 22:17:51', 'unstable_karma': -3, 'submitter': u'ralph', 'user': {'openid': None, 'name': u'ralph', 'show_popups': True, 'id': 128, 'avatar': None, 'groups': [{'name': u'packager'}, {'name': u'bodhiadmin'}, {'name': u'sysadmin-main'}, {'name': u'infra-sig'}], 'email': u'rbean@redhat.com'}, 'locked': False, 'builds': [], 'date_modified': None, 'url': u'https://bodhi.stg.fedoraproject.org/updates/FEDORA-EPEL-2016-184f2c8947', 'test_cases': [], 'notes': u'Fix a regression in the config parser.', 'request': u'testing', 'bugs': [], 'alias': u'FEDORA-EPEL-2016-184f2c8947', 'karma': 0, 'release': {'dist_tag': u'epel7', 'name': u'EPEL-7', 'testing_tag': u'epel7-testing', 'pending_stable_tag': u'epel7-pending', 'long_name': u'Fedora EPEL 7', 'state': u'current', 'version': u'7', 'override_tag': u'epel7-override', 'branch': u'epel7', 'id_prefix': u'FEDORA-EPEL', 'pending_testing_tag': u'epel7-testing-pending', 'stable_tag': u'epel7', 'candidate_tag': u'epel7-testing-candidate'}}>}
[bodhi][MainThread] validate_acls was passed data with nothing to validate.
[bodhi][MainThread] validating request
```

This is because you somehow managed to create 2 updates for the same build 5 seconds apart from each other.

https://bodhi.stg.fedoraproject.org/updates/FEDORA-EPEL-2016-50448945cd
https://bodhi.stg.fedoraproject.org/updates/FEDORA-EPEL-2016-184f2c8947

Amazing.  :P


Resolving patch:
diff --git a/alembic/versions/3aae6532b560_add_a_unique_constraint_to_the_update_.py b/alembic/versions/3aae6532b560_add_a_unique_constraint_to_the_update_.py
new file mode 100644
--- /dev/null
+++ b/alembic/versions/3aae6532b560_add_a_unique_constraint_to_the_update_.py
@@ -0,0 +1,28 @@
+"""Add a unique constraint to the Update.title
+
+Revision ID: 3aae6532b560
+Revises: 6383ec38980
+Create Date: 2016-03-01 19:03:30.088491
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3aae6532b560'
+down_revision = '6383ec38980'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_index('ix_updates_title', table_name='updates')
+    op.create_index(op.f('ix_updates_title'), 'updates', ['title'], unique=True)
+    ### end Alembic commands ###
+
+
+def downgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_index(op.f('ix_updates_title'), table_name='updates')
+    op.create_index('ix_updates_title', 'updates', ['title'], unique=False)
+    ### end Alembic commands ###
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -589,7 +589,7 @@ class Update(Base):
     __include_extras__ = ('meets_testing_requirements', 'url',)
     __get_by__ = ('title', 'alias')
 
-    title = Column(UnicodeText, default=None, index=True)
+    title = Column(UnicodeText, unique=True, default=None, index=True)
 
     karma = Column(Integer, default=0)
     stable_karma = Column(Integer, nullable=True)


Test patch:
diff --git a/bodhi/tests/functional/test_comments.py b/bodhi/tests/functional/test_comments.py
--- a/bodhi/tests/functional/test_comments.py
+++ b/bodhi/tests/functional/test_comments.py
@@ -382,8 +382,9 @@ def test_list_comments_by_update(self):
         self.assertEquals(comment['text'], u'srsly.  pretty good.')
 
     def test_list_comments_by_update_no_comments(self):
+        nvr = u'bodhi-2.0-201.fc17'
         update = Update(
-            title=u'bodhi-2.0-200.fc17',
+            title=nvr,
             #builds=[build],
             #user=user,
             request=UpdateRequest.testing,
@@ -398,7 +399,7 @@ def test_list_comments_by_update_no_comments(self):
         self.db.add(update)
         self.db.flush()
 
-        res = self.app.get('/comments/', {"updates": "bodhi-2.0-200.fc17"})
+        res = self.app.get('/comments/', {"updates": nvr})
         body = res.json_body
         self.assertEquals(len(body['comments']), 0)
 
diff --git a/bodhi/tests/models/test_models.py b/bodhi/tests/models/test_models.py
--- a/bodhi/tests/models/test_models.py
+++ b/bodhi/tests/models/test_models.py
@@ -195,6 +195,7 @@ def do_get_dependencies(self):
 
     def get_update(self, name=u'TurboGears-1.0.8-3.fc11'):
         attrs = self.attrs.copy()
+        attrs['title'] = name
         pkg = self.db.query(model.Package) \
                 .filter_by(name=u'TurboGears').one()
         rel = self.db.query(model.Release) \