Bug 998369 - Add unique constraint to Tasks' RPM name
Add unique constraint to Tasks' RPM name
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: scheduler (Show other bugs)
0.14
Unspecified Unspecified
unspecified Severity unspecified (vote)
: 0.15
: ---
Assigned To: Amit Saha
tools-bugs
:
Depends On:
Blocks: 994789
  Show dependency treegraph
 
Reported: 2013-08-19 03:31 EDT by Amit Saha
Modified: 2018-02-05 19:41 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-02 22:28:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Amit Saha 2013-08-19 03:31:49 EDT
Description of problem:

Currently, an UNIQUE constraint exists for the task name, but not for the RPM name. This allows two tasks to exist (unique as far as Beaker is concerned), but actually pointing to the same RPM file. This doesn't affect Beaker's functioning in anyway, but we can't rely any more on the one-one mapping between the two.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:

Have an one-one mapping between the task name and RPM name.


Additional info:

This is needed so that tools like beaker-sync-tasks which do reasonably rely on the mapping doesn't break.
Comment 2 Amit Saha 2013-08-27 03:13:33 EDT
Adding a unique key constraint and considering that we are using unicode limits us to 255 characters for the RPM name[1]. I will do a check to see how many of the production RPMs exceed that.

[1] https://drupal.org/node/554820
Comment 3 Amit Saha 2013-09-01 21:28:11 EDT
(In reply to Amit Saha from comment #2)
> Adding a unique key constraint and considering that we are using unicode
> limits us to 255 characters for the RPM name[1]. I will do a check to see
> how many of the production RPMs exceed that.

Hmm i was obviously not thinking of file system limits there, which makes that a 0 percent probability of finding one.
Comment 4 Amit Saha 2013-09-01 21:50:10 EDT
On Gerrit: http://gerrit.beaker-project.org/#/c/2191/
Comment 6 xjia 2013-09-03 08:42:40 EDT
Verify:
The length of rpm's name should not be large than 256. That's linux limited. And upload different tasks with same rpm package name, it will fail. 

[root@beaker-client-rhel6 jiaxuan]# pwd
/root/haha/Sanity/jiaxuan
[root@beaker-client-rhel6 jiaxuan]# bkr task-add jiaxuan-1.0-1.noarch.rpm
jiaxuan-1.0-1.noarch.rpm
Success
[root@beaker-client-rhel6 jiaxuan]# cd /root/haha2/Sanity/jiaxuan1/
[root@beaker-client-rhel6 jiaxuan1]# ls
jiaxuan-1.0-1.noarch.rpm  Makefile  PURPOSE  runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# bkr task-add jiaxuan-1.0-1.noarch.rpm
jiaxuan-1.0-1.noarch.rpm
Exception: <Fault 1: <class 'bkr.common.bexceptions.BX'>:Cannot import duplicate task jiaxuan-1.0-1.noarch.rpm>
[root@beaker-client-rhel6 jiaxuan1]# vim
jiaxuan-1.0-1.noarch.rpm  Makefile                  PURPOSE                   runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# vim Makefile
[root@beaker-client-rhel6 jiaxuan1]# vim runtest.sh
[root@beaker-client-rhel6 jiaxuan1]# rm -rf jiaxuan-1.0-1.noarch.rpm
[root@beaker-client-rhel6 jiaxuan1]# cat Makefile | grep PACKAGE_NAME
export PACKAGE_NAME=jiaxuan
[root@beaker-client-rhel6 jiaxuan1]# vim Makefile
[root@beaker-client-rhel6 jiaxuan1]# make package
rhts-mk-build-package
           CURRENT_TAG: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1_0-1
                  NAME: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
               VERSION: 1.0
               RELEASE: 1
            SOURCE_DIR: /root/haha2/Sanity/jiaxuan1
               TMP_DIR: /mnt/testarea/rhts-build-qWczWpH3
             BUILD_DIR: /mnt/testarea/rhts-build-qWczWpH3/rpm-build
  GENERATED_SOURCE_DIR: /mnt/testarea/rhts-build-qWczWpH3/build
           INSTALL_DIR: /mnt/testarea/rhts-build-qWczWpH3/install
Creating tarball: /mnt/testarea/rhts-build-qWczWpH3/build/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1.0-1.tar.gz
tar (child): /mnt/testarea/rhts-build-qWczWpH3/build/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890-1.0-1.tar.gz: Cannot open./
./PURPOSE
: File name too long
./runtest.sh
tar (child): Error is not recoverable: exiting now
./Makefile
tar: Child returned status 2
tar: Error is not recoverable: exiting now
make: *** [noarch-rpm] Error 1
Comment 7 Nick Coghlan 2013-10-02 22:28:19 EDT
Beaker 0.15 has been released.

Note You need to log in before you can comment on or make changes to this bug.