In the new implementation of MappedObject.lazy_create (as of 0.8.2) it relies on a suitable unique constraint being present for the columns passed to it.
We are calling lazy_create for the following tables without the necessary unique constraints:
This causes duplicate rows to be inserted, which manifests as problems in other parts of the code which are calling .one() on a query expecting a single unique result.
The first of this reported by users is:
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:'Invalid Task Type: Multihost'
when invoking bkr workflow commands, however there are many places which would exhibit similar failures due to the duplicate rows.
Patch posted to Gerrit:
*** Bug 816638 has been marked as a duplicate of this bug. ***