Bug 812789

Summary: rhn-satellite-exporter throws exception when package is not found or malformed in channel
Product: Red Hat Satellite 5 Reporter: Martin Minar <mminar>
Component: Satellite SynchronizationAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Ondrej Cienciala <ociencia>
Severity: low Docs Contact:
Priority: low    
Version: 541CC: cperry, jhutar, mkoci, ociencia
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-1.7.38-8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-21 09:34:51 UTC Type: Bug
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: 819081    

Description Martin Minar 2012-04-16 08:50:51 UTC
Description of problem:
In case there was some problem with satellite-sync of channel (or channel contains in some form malformed data) before exporting this channel rhn-satellite-exporter fails with exception.

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

How reproducible:
Always on errata stage

Steps to Reproduce:
1. Sync some channel from errata stage that contains xmlsec1-gnutls-devel-1
.2.9-8.1.i386.rpm (for example rhel-i386-server-5.0.z)
2. Run rhn-satellite-exporter --channel rhel-i386-server-5.0.z --dir /tmp/somedir

  
Actual results:
05:28:34 Gathering channel info...
Appending channels []
05:28:34 Gathering binary RPM info...
05:28:34 Gathering package info...
05:28:34 Gathering errata info...
05:28:34 Gathering kickstart data...
05:28:34 Gathering kickstart files info...


05:28:34 Exporting channel families...
           ____________________
Exporting: #################### - Done!


05:28:35 Exporting arches...
           ____________________
Exporting: #################### - Done!


05:28:35 Exporting arches extra...
           ____________________
Exporting: #################### - Done!


05:28:35 Exporting channel info...
           ____________________
Exporting: Dumping Base Channel Packages
#################### - Done!


05:28:36 Exporting blacklists...
           ____________________
Exporting: #################### - Done!


05:28:36 Exporting short packages...
           ____________________
Exporting: #################### - Done!


05:28:42 Exporting binary RPMs...
           ____________________
Exporting: 05:28:43 
AttributeError caught in dump_rpms.


Expected results:
RPMs from channel are exported.

Additional info:
Exception thrown is:
Exception type exceptions.AttributeError

Exception Handler Information
Traceback (most recent call last):
  File "/usr/share/rhn/satellite_tools/disk_dumper/iss.py", line 847, in dump_rpms
    satellite_path = os.path.join(CFG.MOUNT_POINT, rpm['path'])
  File "/usr/lib64/python2.4/posixpath.py", line 60, in join
    if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

Local variables by frame
Frame join in /usr/lib64/python2.4/posixpath.py at line 60
	                   a = <type 'str'> /var/satellite
	                path = <type 'str'> /var/satellite
	                   b = <type 'NoneType'> None
	                   p = <type 'tuple'> (None,)

Frame dump_rpms in /usr/share/rhn/satellite_tools/disk_dumper/iss.py at line 886
	                   e = <type 'instance'> 'NoneType' object has no attribute 'startswith'
	         dirs_to_rpm = <type 'str'> /tmp/tmp.yJhyvj1738/rpms/28
	                self = <type 'instance'> <satellite_tools.disk_dumper.iss.Dumper instance at 0x3f32fc8>
	               tbout = <type 'cStringIO.StringO'> <cStringIO.StringO object at 0x2ae980116558>
	                  pb = <type 'instance'> <satellite_tools.progress_bar.ProgressBar instance at 0x3f5e3b0>
	                 rpm = <type 'dict'> {'path': None, 'id': 2528}
	      satellite_path = <type 'str'> /var/satellite/redhat/NULL/ea7/xmlsec1-gnutls-devel/1.2.9-8.1/i386/ea773a0b0047b721da642da259e5c63b/xmlsec1-gnutls-devel-1
.2.9-8.1.i386.rpm
	         path_to_rpm = <type 'str'> /tmp/tmp.yJhyvj1738/rpms/28/rhn-package-2528.rpm

Frame main in /usr/share/rhn/satellite_tools/disk_dumper/iss.py at line 1123
	                dirs = <type 'list'> []

Comment 2 Miroslav Suchý 2012-04-16 13:25:23 UTC
Fixed in spacewalk.git d3f88ad2629c3c36d1fc623643599798cb9b2576

Comment 3 Miroslav Suchý 2012-04-16 13:35:15 UTC
cherrypicked to satellite.git as 80989b0137b7bd5ebdc5e23f7a4a0f73b05c3af0

Comment 4 Martin Minar 2012-04-17 12:48:04 UTC
Ok, the exception was replaced with nicer error message, but main issue remains - with first problem the whole process is stopped.

Wouldn't it be better to simply write error message and continue with next package? Ok, when channel is created with --no-rpms there will be thousands of error lines, but in case of one failed package user will still get some result.

Comment 5 Miroslav Suchý 2012-04-17 14:02:15 UTC
1) this is how we operate for ages - when you could not export something (e.g file is missing on disk) we exit gracefully
2) since exporter write a lot of text to output, it can be easy to miss some warning. So our behaviour is:
  a) we finish - your dump is complete
  b) you have some problem and dump is not complete - exit with error

Nearly complete dump is for nothing.

Comment 10 Clifford Perry 2012-09-21 09:34:51 UTC
This issue is resolved with the release of RHN Satellite 5.5. 

As of September 20th 2012, RHN Satellite 5.5 has been generally available. 

Release Notes and other 5.5 documentation can be found here:

 https://access.redhat.com/knowledge/docs/Red_Hat_Network_Satellite/

The associated Errata for the 5.5 release are:

5.5 Satellite GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1296.html

5.5 Upgrade Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1298.html

5.5 RHN Proxy GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1297.html

5.5 RHN Tools GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1299.html

Regards,
Clifford
- Engineering Manager, Satellite