Bug 857892

Summary: rhn-satellite-exporter: incremental errata & ks tree export does not respect --use-rhn-date / --use-sync-date switches
Product: Red Hat Satellite 5 Reporter: Milan Zázrivec <mzazrivec>
Component: Satellite SynchronizationAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Dimitar Yordanov <dyordano>
Severity: high Docs Contact:
Priority: urgent    
Version: 550CC: cperry, dyordano
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-1.7.38-33 Doc Type: Bug Fix
Doc Text:
Cause: A bug in the code. Consequence: When doing an incremental channel export, rhn-satellite-exporter would incorrectly include errata(s) which do not belong to the specified date (time) range. The problem alone would manifest itself by a traceback during synchronization of such broken export. Fix: Simple. Result: rhn-satellite-exporter honors --use-rhn-date / --use-sync-date switches when exporting errata information.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-20 14:17:04 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: 677498    

Description Milan Zázrivec 2012-09-17 12:35:25 UTC
Description of problem:
Channel information serialized into an XML file during channel export contains
errata information in two places:
1. /rhn-satellite/rhn-channels/rhn-channel/@channel-errata
2. /rhn-satellite/rhn-channels/rhn-channel/rhn-channel-errata/errata

While the first is being exported correctly (i.e the list of erratas
is exported either by rhnErrata.last_modified or rhnChannelErrata.modified;
based on what was specified on command line), the second list of erratas
is always being exported based on rhnChannelErrata.modified, regardless
of what was specified on command line.

This naturally poses a problem since:
1. List of the erratas falling into the two intervals will not always match
2. satellite-sync searches for the exported erratas based on the information
contained in the second list

A synchronization error occurs, when the second list contains an errata
which is not contained in the first list.

Version-Release number of selected component (if applicable):
spacewalk-backend-1.7.38-32

How reproducible:
Always

Steps to Reproduce:
1. Satellite 5.5, redhat-rhn-proxy-4.2-as-i386-4 synced
2. rm -rf /var/cache/rhn/xml-*;
3. rhn-satellite-exporter -c redhat-rhn-proxy-4.2-as-i386-4 \
   -d wherever --start-date 20090611000000 --end-date 20110407000000
4. cd wherever
5. xmllint -format channels/redhat-rhn-proxy-4.2-as-i386-4/channel.xml.gz
6. Check whether the erratas contained in the first and second list match
7. Make sure you're able to import the dump
  
Actual results:
The lists do not match, the sync fails with following error:

Exception Handler Information
Traceback (most recent call last):
  File "/usr/bin/satellite-sync", line 143, in main
    return satsync.Runner().main()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 226, in main
    ret = method()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 336, in _step_download_errata
    return self.syncer.download_errata()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 1741, in download_errata
    stream_loader.process(chunk)
  File "/usr/share/rhn/satellite_tools/satsync.py", line 2100, in process
    stream = self.disk_loader.load()
  File "/usr/share/rhn/satellite_tools/xmlDiskSource.py", line 41, in load
    return self._loadFile(filename)
  File "/usr/share/rhn/satellite_tools/xmlDiskSource.py", line 59, in _loadFile
    raise MissingXmlDiskSourceFileError("unable to process file %s" % filename)
MissingXmlDiskSourceFileError: unable to process file /var/satellite/channel-dumper/dump-iso/errata/5/rhn-erratum-4835.xml

Expected results:
The lists match, it is possible to import the dump.

Additional info:
N/A

Comment 1 Milan Zázrivec 2012-09-17 12:53:16 UTC
spacewalk.git master: aafc6ca94b190e08f72ff9be20635732f9c37679

Comment 7 errata-xmlrpc 2012-09-20 14:17:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-1300.html