Bug 185632

Summary: Internal 500 message when attempting to re-upload a Solaris package with same name, but different headers
Product: Red Hat Satellite 5 Reporter: Clifford Perry <cperry>
Component: SolarisAssignee: Pete Vetere <pvetere>
Status: CLOSED CURRENTRELEASE QA Contact: Matthew Davis <mdavis>
Severity: medium Docs Contact:
Priority: medium    
Version: 500CC: bnackash, rhn-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhn410 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-19 22:07:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 188662    
Bug Blocks: 196477    

Description Clifford Perry 2006-03-16 15:34:29 UTC
Description of problem:
If you get an rpm spec file and build a package, upload the package using
rhnpush, then modify some of the header data of the spec file and build a new
package (with same name, version, release, arch information) and attempt to use
rhnpush to re-upload the new package the Satellite will capture this state and
report back to rhnpush the failure, unless you use the --force option to
over-ride anyway:

[root@rlx-1-22 tmp]# rhnpush -vv --server=http://rlx-1-22.rhndev.redhat.com/APP
-u admin -p xxxx rhnlib-1.3-13.useragent.noarch.rpm
Connecting to http://rlx-1-22.rhndev.redhat.com/APP
Uploading package rhnlib-1.3-13.useragent.noarch.rpm

Result codes: 200 OK
Using POST request
Uploading failed for rhnlib-1.3-13.useragent.noarch.rpm (error: package
recompiled); [['md5sum', '13de8b96aaaed7530e0ddd3a9bd129a0',
'9df0268f6b3c84303620ff7cedb143b9'], ['build_time', '2006-03-16 15:13:54',
'2006-03-16 15:14:41'], ['last_modified', '2006-03-16 10:16:37', '2006-03-16
10:16:12'], ['cookie', 'dhcp59-213.rdu.redhat.com 1142522034',
'dhcp59-213.rdu.redhat.com 1142522081'], ['files::md5',
'1183b60218519482a8dbdad9f2741da9', '33565fa15ab16f8da76ffc125483db96']]

[root@rlx-1-22 tmp]# rhnpush -vv --server=http://rlx-1-22.rhndev.redhat.com/APP
-u admin -p xxxx rhnlib-1.3-13.useragent.noarch.rpm --force
Connecting to http://rlx-1-22.rhndev.redhat.com/APP
Uploading package rhnlib-1.3-13.useragent.noarch.rpm

Result codes: 200 OK
Using POST request
[root@rlx-1-22 tmp]#

But if you do something similar with Solaris packages - such as using a modified
solaris2mpm command to create new headers (see bug#184156 รข Broken package
dependencies for Solaris Packages), the Solaris mpm upload code does not cleanly
capture this state and instead fails with an internal server 500 message, again
though, working if --force is used:

bash-2.03# ls -l */SUNWbart*mpm -rw-r--r--   1 root     other      20619 Mar 15
16:02 current/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
-rw-r--r--   1 root     other      20613 Mar 15 16:04
modified/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
bash-2.03# rhnpush -vv --server=http://rlx-1-22.rhndev.redhat.com/APP -u admin
-p xxxx current/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
Connecting to http://rlx-1-22.rhndev.redhat.com/APP
Uploading package current/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
Result codes: 200 OK
Using POST request
bash-2.03# rhnpush -vv --server=http://rlx-1-22.rhndev.redhat.com/APP -u admin
-p xxxx modified/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
Connecting to http://rlx-1-22.rhndev.redhat.com/APP
Uploading package modified/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
Result codes: 200 OK
Using POST request
Internal server error 500 Internal Server Error

bash-2.03# rhnpush -vv --server=http://rlx-1-22.rhndev.redhat.com/APP -u admin
-p xxxx modified/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm --force
Connecting to http://rlx-1-22.rhndev.redhat.com/APP
Uploading package modified/SUNWbart-11.10.0-2005.01.21.15.53.sparc-solaris.mpm
Result codes: 200 OK
Using POST request
bash-2.03# 

The internal server error traceback mail generated is:

Headers passed in:
	Accept-Encoding: identity
	Content-Length: 20613
	Content-Type: application/x-rpm
	Host: rlx-1-22.rhndev.redhat.com
	User-Agent: rhnpush
	X-RHN-Upload-Auth: YWRtaW4=:ZG9nOGNvZGU=
	X-RHN-Upload-File-MD5sum: 50acbe4d3e0118af387cb8034899f522
	X-RHN-Upload-Force: 0
	X-RHN-Upload-Package-Arch: sparc-solaris
	X-RHN-Upload-Package-Name: SUNWbart
	X-RHN-Upload-Package-Release: 2005.01.21.15.53
	X-RHN-Upload-Package-Version: 11.10.0
	X-RHN-Upload-Packaging: mpm

Exception Handler Information
Traceback (most recent call last):
  File "/usr/share/rhn/server/apacheUploadServer.py", line 93, in _wrapper
    ret = function(req)
  File "/usr/share/rhn/upload_server/handlers/package_push/package_push.py",
line 133, in handler
    relative_path=self.rel_package_path, org_id=self.org_id)
  File "/usr/share/rhn/server/rhnPackageUpload.py", line 223, in push_package
    oh = rhn_mpm.get_package_header(orig_path)
  File "/usr/share/rhn/common/rhn_mpm.py", line 29, in get_package_header
    return load(filename=filename, file=file, fd=fd)[0]
  File "/usr/share/rhn/common/rhn_mpm.py", line 52, in load
    raise e
InvalidPackageError



One item to note is that during investigation I was not able to generate the
internal 500 message after selecting to delete the package within the WebUI
(even though the file is on the file system still), which indicates that you
have to either select to delete a package before attempting to re-upload the
package, or use the --force option with rhnpush when re-uploading a modified
version of the same package (name, version, release, arch). 

Basically Solaris server side upload for mpm's needs to do a better job of
handling this type of situation :)  and be as robust as linux packages. 


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

How reproducible:
Always

Steps to Reproduce:  See notes.

Comment 1 Pete Vetere 2006-03-23 13:04:52 UTC
I have fixed this bug.  The behavior, in this case, was correct but we were
handling it badly.  Basically, the 500 was occurring because a solaris patch or
package was being uploaded when a version of the same name/release/arch already
existed on the server, but possessed a different build time and/or build host. 
This is enough of a difference for us to consider the package "different".

In the "correct" scenario, we should error back to the user and inform them of
the situation when this happens.  However, our logic was broken internally so
that it never got this far.

I fixed the broken logic on the server side and enhanced the error message
feedback on the rhnpush client.  The user should now no longer receive 500s when
this happens, but should instead receive an error message suggesting that he or
she uses the --force option.


Comment 7 Beth Nackashi 2006-04-22 18:16:15 UTC
bperkins is QA contact for all Solaris bugs

Comment 8 Matthew Davis 2006-06-14 18:45:36 UTC
Verified with rhn-solaris-bootstrap-4.1.0-13-sparc-sol10.

bash-3.00# rhnpush --server=rlx-1-20.rhndev.redhat.com
SUNWxwrtl-6.6.2.7400-0.2004.12.15.sparc-solaris.mpm -c sol-10-base
/opt/redhat/rhn/solaris/etc/sysconfig/rhn/rhnpushrc is missing tolerant option.
Option tolerant is being set to the default value of 0.
bash-3.00# solaris2mpm SUNWxwrtl.pkg
Opening archive, this may take a while
Writing SUNWxwrtl-6.6.2.7400-0.2004.12.15.sparc-solaris.mpm
bash-3.00# rhnpush --server=rlx-1-20.rhndev.redhat.com
SUNWxwrtl-6.6.2.7400-0.2004.12.15.sparc-solaris.mpm -c sol-10-base
/opt/redhat/rhn/solaris/etc/sysconfig/rhn/rhnpushrc is missing tolerant option.
Option tolerant is being set to the default value of 0.
Package SUNWxwrtl-6.6.2.7400-0.2004.12.15.sparc-solaris.mpm mismatch -- Skipping
Upload (use --force to force upload)
bash-3.00# rhnpush --server=rlx-1-20.rhndev.redhat.com
SUNWxwrtl-6.6.2.7400-0.2004.12.15.sparc-solaris.mpm -c sol-10-base --force
/opt/redhat/rhn/solaris/etc/sysconfig/rhn/rhnpushrc is missing tolerant option.
Option tolerant is being set to the default value of 0.
bash-3.00#


Comment 9 Beth Nackashi 2006-07-19 22:07:08 UTC
closing -- currentrelease