From 04d04f31e08ba30aa289e5593f42fec748df9835 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Wed, 30 Nov 2016 18:25:33 +0000
Subject: [PATCH] Reload builds and releases after we commit the transaction
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
bodhi/server/services/updates.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/bodhi/server/services/updates.py b/bodhi/server/services/updates.py
index 5afd03b0..28ac2cef 100644
--- a/bodhi/server/services/updates.py
+++ b/bodhi/server/services/updates.py
@@ -375,6 +375,17 @@ def new_update(request):
# the builds as signed.
transaction.commit()
+ # After we commit the transaction, we need to get the builds and releases again, since they
+ # were tied to the previous session that has now been terminated.
+ builds = []
+ releases = set()
+ for build in data['builds']:
+ # At this moment, we are sure the builds are in the database (that is what the commit
+ # was for actually).
+ build = Build.get(nvr, request.db)
+ builds.append(build)
+ releases.add(build.release)
+
if data.get('edited'):
log.info('Editing update: %s' % data['edited'])
--
2.11.0