Bug 180347

Summary: Link for packages pushed with rhnpush does not show up sometimes.
Product: [Retired] Red Hat Network Reporter: John Wregglesworth <wregglej>
Component: RHN/BackendAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED CURRENTRELEASE QA Contact: Max Spevack <mspevack>
Severity: medium Docs Contact:
Priority: medium    
Version: rhn400CC: bretm, rhn-bugs, tsanders, wregglej
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhn406 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-15 19:07:26 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:    
Bug Blocks: 178198, 185091, 185572    

Description John Wregglesworth 2006-02-07 14:44:23 UTC
Description of problem: If you upload a package with rhnpush with the --header
option, and then upload it again without the --header option, the link that
allows you to download the package from the channel never appears. The bug
appears to be in the rhnpsuh backend.

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


How reproducible: Always


Steps to Reproduce:
1. Use rhnpush to upload a rpm with the --header option

2. Check the webui to see that the package's Details page does not have a link.

3. Use rhnpush again to upload the same rpm into the same channel, but without
the --header option this time.

4. Check the package's Details page in the webui again and see that it still
doesn't have the link that allows you to download the package. Since you at this
point have uploaded the actual file, not just the header, it should be there.
  
Actual results: The link that allows you to download the package does not appear.


Expected results: The link should appear when you upload the package without
passing the --header to rhnpush.

Comment 2 Pradeep Kilambi 2006-02-07 15:42:27 UTC
Bug reproduced and fixed as follows:

before fix:
eg:
- rhnpush -vvvv -cpushstuffhere --server=localhost --nosig zip-2.3-16.i386.rpm
--header
   - on web UI package details page link appears without download links(expected)

- rhnpush -vvvv -cpushstuffhere --server=localhost --nosig zip-2.3-16.i386.rpm

- package details page does'nt show the download link.

bug is that first when we run rhnpush with --header it puts the metadata info on
to the db . But next time when rhnpush without --header in step two it thinks
the package already exists based on metadata info.This is wrong. The desired
behaviour here should be that it should check the path of the package on the db
and also that the path exists on the file system.

this additional condition is included in 
file: svn/rhn/eng/backend/server/rhnPackage/upload in push_package method as a fix.

there are four cases here:

case 1:checks if the path exists in the db and also on the file system.
if it does then no need to copy anything just do the usual.

case2: file exists on file system but path not in db.then add the 
relative path to the db 'path' field quering based on md5sum of the pkg

case3: if no file on file system but path exists.then we write the
file to file system

case4: file does'nt exists on File System and no path in db .then we write both.

this fixed the problem.

after the fix:
eg:
- rhnpush -vvvv -cpushstuffhere --server=localhost --nosig zip-2.3-16.i386.rpm
--header
   - on web UI package details page link appears without download links(expected)

- rhnpush -vvvv -cpushstuffhere --server=localhost --nosig zip-2.3-16.i386.rpm

- package details page shows the download link(expected).

this fixes the bug.
the fix checked into HEAD and RELEASE 4.0




Comment 3 Pradeep Kilambi 2006-02-07 16:18:32 UTC
oops the file path above is:
>file: svn/rhn/eng/backend/server/rhnPackage/upload in push_package method as a
>fix.
file: svn/rhn/eng/backend/server/rhnPackageUpload.py in push_package method as a
fix.

Comment 4 Max Spevack 2006-02-16 18:52:18 UTC
upload with --header (no download link, as expected)
upload again, package download is available

rhnpush-4.0.5-70.rhel4

PASSES_QA

Comment 5 Max Spevack 2006-03-06 17:41:45 UTC
RELEASE_PENDING

Comment 6 Pradeep Kilambi 2006-03-10 15:42:38 UTC
Apparently the bug is tested for binary rpms but not the source.. added a fix to
see that the following works ..

The problem is when the uploadPackages is called on the server it does a query
to get the packagepath from the db .It was quering thet from rhnpackages.this
works fine if its a binary rpm .but for source rpms it has to query a different
table rhnpackagesource ..that why its erring off saying unscriptable object as
follows ...

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 258, in push_package
    path_dict = rs_path[0]
TypeError: unsubscriptable object 

Test Plan:

- take a bunch of src.rpms of rhel-3 and push as follows:

[root@fjs-0-08 ~]# rhnpush -vvv  -cpush-pkg-3 -cpush-pkgs
--server=http://rlx-2-20.rhndev.redhat.com  --dir test/ --source --nosig

- now take a similar set of packages but now (may be different version) and do
the same:
[root@fjs-0-08 ~]# rhnpush -vvv  -cpush-pkg-3 -cpush-pkgs
--server=http://rlx-2-20.rhndev.redhat.com  --dir test2/ --source --nosig

now it should not error off ..similarly i tested it for binaries and works fine ..

Comment 7 Pradeep Kilambi 2006-03-10 15:47:18 UTC
> Test Plan:
> 
> - take a bunch of src.rpms of rhel-3 and push as follows:
> 
sorry! does'nt have to be rhel 3 any two packages that differ to enable
packages.diff on the server

Comment 8 Vlady Zlatkin 2006-03-10 16:13:10 UTC
comment #6 and comment #7 do not apply to this bug any more, see 185091

Comment 9 Todd Warner 2006-03-15 19:07:26 UTC
Closing upon release of RHN 406