Hide Forgot
+++ This bug was initially created as a clone of Bug #752869 +++ Description of problem: If two lab controllers try to add the same new distro at the same time only one of them will succeed.
Bug 752869 was fixed in Beaker 0.8 with a workaround: the call to add a new distro was split into two separate calls, and the first (subject to the race) was permitted to fail. The proper fix for this bug is to use MappedObject.lazy_create, and to make that method be race-free using nested transactions. session.begin_nested() try: item = cls(**kwargs) session.commit() except IntegrityError: session.rollback() item = cls.query.filter_by(**kwargs).one()