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

Amit Saha asaha at redhat.com
Mon Sep 2 00:22:01 UTC 2013



----- Original Message -----
> From: "Amit Saha" <asaha at redhat.com>
> To: "Beaker development" <beaker-devel at lists.fedorahosted.org>
> Sent: Monday, September 2, 2013 9:46:58 AM
> Subject: [Beaker-devel] Enforcing a unique constraint on the RPM name for	tasks
> 
> 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.

A test in test_model.py should do the trick.


More information about the Beaker-devel mailing list