Bug 196471 - rhnpush gives traceback when it trys to override a package with same nvrea and null org on server..
rhnpush gives traceback when it trys to override a package with same nvrea an...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Other (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Pradeep Kilambi
Preethi Thomas
:
Depends On:
Blocks: 248627
  Show dependency treegraph
 
Reported: 2006-06-23 11:47 EDT by Pradeep Kilambi
Modified: 2008-04-02 20:24 EDT (History)
0 users

See Also:
Fixed In Version: sat510
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-02 20:24:04 EDT
Type: ---
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 Pradeep Kilambi 2006-06-23 11:47:19 EDT
Description of problem:
rhnpush gives traceback on server with a uniqueness constraint violation when we
try to repush a redhat owned package(with null on serever) as a non-null org
package. This results in a situation where the package to be uploaded is
available on that particular channel with same nvrea but different orgs.

So as it has different orgs it calculates a new packageid for this package and
hence uploads the same package with different pids into the rhnchannelPackage
 table and so does insert it as a new package.

Now in the next step when it calls rhn_channel.refresh_newest_package,
it does :
inserts a row into rhnChannelNewestPackage with channel_id, name_id, evr_id,
package_id, package_arch_id.
this table has a constraint on ( channel_id, name_id, package_arch_id )
and thats when it hits the uniqueness constraint error ...

Version-Release number of selected component (if applicable):
USe any rhnpush for ex: rhnpush-4.2.0-14.rhel4.noarch.rpm   
Satellite: any ex:3.7,4.0,4.1,4.2

How reproducible:
Always

Steps to Reproduce:
1. First I create a clone channel with redhat owned packages.

2. Repush an existing package to  the channel and we see a internal server error..

[root@rlx-2-18 importlib]# rhnpush --server=rlx-2-18.rhndev.redhat.com
-cclone-3-rhel-i386-as-4 -uadmin -pdog8code -vvv
/mnt/engarchive/released/RHEL-4/GOLD/AS/i386/tree/RedHat/RPMS/anaconda-help-10.1.0-1.noarch.rpm
Connecting to http://rlx-2-18.rhndev.redhat.com/APP
url is http://rlx-2-18.rhndev.redhat.com/PACKAGE-PUSH
Result codes: 200 OK
Computing md5sum and package Info .This may take sometime ...
Package
/mnt/engarchive/released/RHEL-4/GOLD/AS/i386/tree/RedHat/RPMS/anaconda-help-10.1.0-1.noarch.rpm
already exists on the RHN Server-- Skipping Upload....
Internal Server Error

and error on server is...

raise sql_base.SQLSchemaError(e.code, e.message, e.context)
SQLSchemaError: (1, 'ORA-00001: unique constraint (RHNSAT.RHN_CNP_CID_NID_UQ)
violated', 'ORA-06512: at "RHNSAT.RHN_CHANNEL", line 811\nORA-06512: at line
1\n', 'Cursor_InternalExecute()') 
  
Expected results:

Not suppose to throw the traceback. Probaly may warn the user not to do this again
Additional info:
Comment 1 Pradeep Kilambi 2006-07-06 10:35:48 EDT
Before Fix:
-----------

[pkilambi@prad ~]$ rhnpush --server=rlx-2-08.rhndev.redhat.com --username=admin
--password=dog8code --channel=rhel-i386-desktop-3
Desktop/anaconda-images-9.1-3.RHEL.noarch.rpm
Internal Server Error


We need to make sure that user refrains from pushing packages to overide redhat
owned packages. But, For now atleast we should catch an exception instead of
allowing an Internal server error. This way user will know that a unique
constraint is violated.

in server/importlib/backend.py

@@ -938,7 +940,10 @@
         refresh_newest_package =
self.dbmodule.Procedure('rhn_channel.refresh_newest_package')
         update_channel = self.dbmodule.Procedure('rhn_channel.update_channel')
         for channel_id, (added_packages_list, deleted_packages_list) in
affected_channels.items():
-            refresh_newest_package(channel_id, caller)
+            try:
+                refresh_newest_package(channel_id, caller)
+            except rhnSQL.SQLError, e:
+                raise rhnFault(23, str(e[1]), explain=0)
             if deleted_packages_list:
                 invalidate_ss = 1
             else:

Test Run:
----------
[pkilambi@prad ~]$ rhnpush --server=rlx-2-08.rhndev.redhat.com --username=admin
--password=dog8code --channel=rhel-i386-desktop-3
Desktop/anaconda-images-9.1-3.RHEL.noarch.rpm

Error Message:
    ORA-00001: unique constraint (JSLAGLE5.RHN_CNP_CID_NID_UQ) violated
Error Class Code: 23
Error Class Info: Could not update database entry.
Comment 3 Preethi Thomas 2007-10-18 08:58:15 EDT
verified.
[root@fjs-0-10 ~]# rhnpush --server=fjs-0-10.rhndev.redhat.com -cbug196471
-uadmin -pdog8code -vvv anaconda-help-10.1.0-1.noarch.rpm 
Connecting to http://fjs-0-10.rhndev.redhat.com/APP
url is http://fjs-0-10.rhndev.redhat.com/PACKAGE-PUSH
Result codes: 200 OK
Computing md5sum and package Info .This may take sometime ...
Package anaconda-help-10.1.0-1.noarch.rpm Not Found on RHN Server -- Uploading
Uploading package anaconda-help-10.1.0-1.noarch.rpm
Using POST request

Error Message:
    ORA-00001: unique constraint (RHNSAT.RHN_CNP_CID_NID_UQ) violated
Error Class Code: 23
Error Class Info: Could not update database entry.
Comment 6 Devan Goodwin 2008-03-25 20:11:34 EDT
Verified against stage. Release pending.
Comment 7 Brandon Perkins 2008-04-02 20:24:04 EDT
5.1 Sat GA so Closed for Current Release.

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