[Beaker-devel] Enforcing a unique constraint on the RPM name for tasks

Amit Saha asaha at redhat.com
Sun Sep 1 23:46:58 UTC 2013


Hi all,

This bug [1] was filed and is being worked upon to ensure that we do not end up
with the case of having different tasks pointing to the same RPM. Looking
at the task upload/save code, one of the first checks that is being done is that
an RPM with the same filename doesn't already exist on disk. And thus, Beaker would 
reject if an attempt was made to upload an RPM (with the same filename).

Thus, the only way we could have ended with multiple tasks pointing to the same RPM
is that these tasks were perhaps uploaded when we did not have this check yet in Beaker.

>From the implementation point of view, this is just about making the appropriate change in
model.py:

-        Column('rpm', Unicode(2048)),
+        Column('rpm', Unicode(255), unique=True),

Also, as commented in [2], I will do a check and see if we have RPMs which are above the limit.
Writing the test seems to be a little non-trivial, considering the above.


[1] https://bugzilla.redhat.com/show_bug.cgi?id=998369
[2] https://bugzilla.redhat.com/show_bug.cgi?id=998369#c2

-Amit.




More information about the Beaker-devel mailing list